Skip to content

Commit

Permalink
Pull out semester constant and uphold name invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
Archit404Error committed Mar 2, 2024
1 parent 4371da2 commit a2ba1bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const SEMESTER = "sp24";
3 changes: 2 additions & 1 deletion src/forms/controllers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import moment from "moment-timezone";
import { SEMESTER } from "../constants";
import { getStartOfToday, isToday } from "../utils";
import { initSheet } from "./formTracker";
import { Form, FormModel } from "./models";
Expand All @@ -15,7 +16,7 @@ const ingestForms = async () => {
const form = await FormModel.findOne({ title: row.get("Name") });
if (!form) {
const newForm = new FormModel({
title: row.get("Name"),
title: `${row.get("Name")} ${SEMESTER}`,
ingestedDate: moment().tz("America/New_York").toDate(),
dueDate: moment
.tz(row.get("Due Date"), "MM/DD/YYYY", "America/New_York")
Expand Down
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const sendFormDM = async (form: Form, userEmails: string[]) => {
.toLowerCase()
.replace(" ", "-")
.replace(/[.,\/#!$%\^&\*;:{}=`~()]/g, "");
channelTitle = `${channelTitle}-fa23-reminder`;
channelTitle = `${channelTitle}-reminder`;
console.log(`Attempting to create channel ${channelTitle}`);
const response = await slackbot.client.conversations.create({
name: channelTitle,
});
Expand Down

0 comments on commit a2ba1bc

Please sign in to comment.