@@ -86,6 +86,8 @@ def accept_submission(
8686 tornado_files : dict [str , list ["HTTPFile" ]],
8787 language_name : str | None ,
8888 official : bool ,
89+ override_max_number : bool = False ,
90+ override_min_interval : bool = False ,
8991) -> Submission :
9092 """Process a contestant's request to submit a submission.
9193
@@ -105,6 +107,8 @@ def accept_submission(
105107 official: whether the submission was sent in during a regular
106108 contest phase (and should be counted towards the score/rank) or
107109 during the analysis mode.
110+ override_max_number: skip checks for the maximum number of submissions
111+ override_min_interval: skip checks for the minimum interval between submissions
108112
109113 return: the resulting submission, if all went well.
110114
@@ -118,23 +122,24 @@ def accept_submission(
118122
119123 # Check whether the contestant is allowed to submit.
120124
121- if not check_max_number (sql_session , contest .max_submission_number ,
122- participation , contest = contest ):
123- raise UnacceptableSubmission (
124- N_ ("Too many submissions!" ),
125- N_ ("You have reached the maximum limit of "
126- "at most %d submissions among all tasks." ),
127- contest .max_submission_number )
125+ if not override_max_number :
126+ if not check_max_number (sql_session , contest .max_submission_number ,
127+ participation , contest = contest ):
128+ raise UnacceptableSubmission (
129+ N_ ("Too many submissions!" ),
130+ N_ ("You have reached the maximum limit of "
131+ "at most %d submissions among all tasks." ),
132+ contest .max_submission_number )
128133
129- if not check_max_number (sql_session , task .max_submission_number ,
130- participation , task = task ):
131- raise UnacceptableSubmission (
132- N_ ("Too many submissions!" ),
133- N_ ("You have reached the maximum limit of "
134- "at most %d submissions on this task." ),
135- task .max_submission_number )
134+ if not check_max_number (sql_session , task .max_submission_number ,
135+ participation , task = task ):
136+ raise UnacceptableSubmission (
137+ N_ ("Too many submissions!" ),
138+ N_ ("You have reached the maximum limit of "
139+ "at most %d submissions on this task." ),
140+ task .max_submission_number )
136141
137- if not is_last_minutes (timestamp , participation ):
142+ if not override_min_interval and not is_last_minutes (timestamp , participation ):
138143 if not check_min_interval (sql_session , contest .min_submission_interval ,
139144 timestamp , participation , contest = contest ):
140145 raise UnacceptableSubmission (
0 commit comments