Grace Day Auto-Calculation - #74
Conversation
| dateDue: new Date('2026-09-11T12:00:00Z'), // A friday | ||
| expectedGraceDays: -1 | ||
| }); | ||
| }); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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}`); |
There was a problem hiding this comment.
I'm not super happy that we are making another API call. Don't we already have the assignment?
No description provided.