@@ -86,6 +86,8 @@ def accept_submission(
86
86
tornado_files : dict [str , list ["HTTPFile" ]],
87
87
language_name : str | None ,
88
88
official : bool ,
89
+ override_max_number : bool = False ,
90
+ override_min_interval : bool = False ,
89
91
) -> Submission :
90
92
"""Process a contestant's request to submit a submission.
91
93
@@ -105,6 +107,8 @@ def accept_submission(
105
107
official: whether the submission was sent in during a regular
106
108
contest phase (and should be counted towards the score/rank) or
107
109
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
108
112
109
113
return: the resulting submission, if all went well.
110
114
@@ -118,23 +122,24 @@ def accept_submission(
118
122
119
123
# Check whether the contestant is allowed to submit.
120
124
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 )
128
133
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 )
136
141
137
- if not is_last_minutes (timestamp , participation ):
142
+ if not override_min_interval and not is_last_minutes (timestamp , participation ):
138
143
if not check_min_interval (sql_session , contest .min_submission_interval ,
139
144
timestamp , participation , contest = contest ):
140
145
raise UnacceptableSubmission (
0 commit comments