@@ -135,11 +135,13 @@ def run_module(filename, input=None):
135135 return run_command (["python" , filename ], input )
136136
137137
138- def within_deadline (before = 5 , after = 5 ):
138+ def submission_open (before = 5 , after = 5 ):
139139 """Check if the current time is within the user's submission window.
140140
141- The window is extended `before` minutes prior to the release date
142- and `after` minutes beyond the due date (or late due date, if set).
141+ The window starts at the release date and ends at the due date (or late
142+ due date, if set). This function applies a tolerance by including times:
143+ * `before` minutes prior to the release date
144+ * `after` minutes beyond the due/late date
143145
144146 Args:
145147 before (int): Minutes to extend the window before the release date.
@@ -156,7 +158,7 @@ def within_deadline(before=5, after=5):
156158 except FileNotFoundError :
157159 return False
158160
159- # Get the user 's assignment dates
161+ # Get the assignment 's dates specific to the user
160162 assignment = metadata ["users" ][0 ]["assignment" ]
161163 beg = datetime .fromisoformat (assignment ["release_date" ])
162164 end = datetime .fromisoformat (assignment ["due_date" ])
@@ -173,6 +175,14 @@ def within_deadline(before=5, after=5):
173175 return beg <= now <= end
174176
175177
178+ def submission_closed ():
179+ """Check if the current time is outside the user's submission window.
180+
181+ See submission_open() for more details. This function returns the opposite.
182+ """
183+ return not submission_open ()
184+
185+
176186def postpone_tests (
177187 title = "Ready to grade" ,
178188 message = "Your submission has been received and will be graded manually." ,
0 commit comments