Skip to content

Grace Day Auto-Calculation - #74

Open
jclegg03 wants to merge 2 commits into
leesjensen:mainfrom
jclegg03:main
Open

Grace Day Auto-Calculation#74
jclegg03 wants to merge 2 commits into
leesjensen:mainfrom
jclegg03:main

Conversation

@jclegg03

Copy link
Copy Markdown

No description provided.

dateDue: new Date('2026-09-11T12:00:00Z'), // A friday
expectedGraceDays: -1
});
});

@leesjensen leesjensen Sep 11, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? if due on saturday and turned in on sunday is -1 then shouldn't due on friday turned in on sunday be -2?

The rule is pretend that sundays don't exist. Depending on how you calculate doesn't exist, I think one of these have to be wrong.

We should also have a test for due on Friday turn in on Tuesday. -3.

What about positive tests?

Due on Monday turned in on the Saturday before. (+1)
Due on Friday turned in on the Monday before. (+4)
Due on Monday turned in three weeks earlier (+18).

graceDayTest({
dateSubmitted: new Date('2026-09-09T12:00:01Z'), // A wednesday
dateDue: new Date('2026-09-09T12:00:00Z'), // A wednesday
expectedGraceDays: -1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be clearer if the comment was

// One second late

// Mastery updates never attach a comment, so there's no need to look up the due date.
let dateDue = null;
if (!isMastery) {
const assignment = await canvasApi(`/courses/${courseId}/assignments/${assignmentId}`);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super happy that we are making another API call. Don't we already have the assignment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants