Skip to content

Commit

Permalink
Resolve form title bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Archit404Error committed Mar 22, 2024
1 parent 708c574 commit b479fb4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/forms/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ const ingestForms = async () => {
const rows = await formInfoSheet.getRows();

for (const row of rows) {
const form = await FormModel.findOne({ title: row.get("Name") });
const formTitle = `${row.get("Name")} ${SEMESTER}`;
const form = await FormModel.findOne({
title: formTitle,
});
if (!form) {
const newForm = new FormModel({
title: `${row.get("Name")} ${SEMESTER}`,
title: formTitle,
ingestedDate: moment().tz("America/New_York").toDate(),
dueDate: moment
.tz(row.get("Due Date"), "MM/DD/YYYY", "America/New_York")
Expand All @@ -47,12 +50,14 @@ const getPendingMembers = async () => {
"dueDate",
getStartOfToday()
);

logWithTime(
`Upcoming Forms: ${upcomingForms.map(
(upcomingForm) =>
`${upcomingForm.title} is due ${dateToESTString(upcomingForm.dueDate)}`
)}`
);

for (const form of upcomingForms) {
let pendingMembers = [];
for (const row of rows) {
Expand Down

0 comments on commit b479fb4

Please sign in to comment.