Skip to content

Commit fccf68f

Browse files
aguss787veluca93
authored andcommitted
Allow contestant to see submission after the contest ends
1 parent adf02f8 commit fccf68f

4 files changed

Lines changed: 24 additions & 21 deletions

File tree

cms/server/contest/handlers/task.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class TaskDescriptionHandler(ContestHandler):
5656
5757
"""
5858
@tornado_web.authenticated
59-
@actual_phase_required(0, 3)
59+
@actual_phase_required(0, 1, 2, 3, 4)
6060
@multi_contest
6161
def get(self, task_name):
6262
task = self.get_task(task_name)
@@ -71,7 +71,7 @@ class TaskStatementViewHandler(FileHandler):
7171
7272
"""
7373
@tornado_web.authenticated
74-
@actual_phase_required(0, 3)
74+
@actual_phase_required(0, 1, 2, 3, 4)
7575
@multi_contest
7676
def get(self, task_name: str, lang_code: str):
7777
task = self.get_task(task_name)
@@ -97,7 +97,7 @@ class TaskAttachmentViewHandler(FileHandler):
9797
9898
"""
9999
@tornado_web.authenticated
100-
@actual_phase_required(0, 3)
100+
@actual_phase_required(0, 1, 2, 3, 4)
101101
@multi_contest
102102
def get(self, task_name: str, filename: str):
103103
task = self.get_task(task_name)

cms/server/contest/handlers/tasksubmission.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class TaskSubmissionsHandler(ContestHandler):
121121
122122
"""
123123
@tornado_web.authenticated
124-
@actual_phase_required(0, 3)
124+
@actual_phase_required(0, 1, 2, 3, 4)
125125
@multi_contest
126126
def get(self, task_name):
127127
participation: Participation = self.current_user
@@ -234,7 +234,7 @@ def add_task_score(self, participation: Participation, task: Task, data: dict):
234234
task.score_precision, translation=self.translation)
235235

236236
@tornado_web.authenticated
237-
@actual_phase_required(0, 3)
237+
@actual_phase_required(0, 1, 2, 3, 4)
238238
@multi_contest
239239
def get(self, task_name, submission_num):
240240
task = self.get_task(task_name)
@@ -294,7 +294,7 @@ class SubmissionDetailsHandler(ContestHandler):
294294
refresh_cookie = False
295295

296296
@tornado_web.authenticated
297-
@actual_phase_required(0, 3)
297+
@actual_phase_required(0, 1, 2, 3, 4)
298298
@multi_contest
299299
def get(self, task_name, submission_num):
300300
task = self.get_task(task_name)
@@ -335,7 +335,7 @@ class SubmissionFileHandler(FileHandler):
335335
336336
"""
337337
@tornado_web.authenticated
338-
@actual_phase_required(0, 3)
338+
@actual_phase_required(0, 1, 2, 3, 4)
339339
@multi_contest
340340
def get(self, task_name, submission_num, filename):
341341
if not self.contest.submissions_download_allowed:

cms/server/contest/templates/contest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ <h3 id="countdown_box">
177177
<span id="unread_count" class="label label-warning no_unread"></span>
178178
</a>
179179
</li>
180-
{% if actual_phase == 0 or actual_phase == 3 or participation.unrestricted %}
180+
{% if actual_phase >= 0 or participation.unrestricted %}
181181
{% for t_iter in contest.tasks %}
182182
<li class="nav-header">
183183
{{ t_iter.name }}

cms/server/contest/templates/task_submissions.html

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,29 @@ <h1>{% trans name=task.title, short_name=task.name %}{{ name }} ({{ short_name }
225225
</div>
226226
{% endif %}
227227

228+
{% if actual_phase == 0 or actual_phase == 3 or participation.unrestricted %}
229+
228230
<h2 style="margin-bottom: 10px">{% trans %}Submit a solution{% endtrans %}</h2>
229231

230-
{% set task_type = get_task_type(dataset=task.active_dataset) %}
231-
{% if task_type.ALLOW_PARTIAL_SUBMISSION %}
232+
{% set task_type = get_task_type(dataset=task.active_dataset) %}
233+
{% if task_type.ALLOW_PARTIAL_SUBMISSION %}
232234
<p><strong>{% trans %}You may submit any subset of outputs in a single submission.{% endtrans %}</strong></p>
233-
{% endif %}
235+
{% endif %}
234236

235-
{% if submissions_left is not none %}
237+
{% if submissions_left is not none %}
236238
<div class="span5">
237239
<p>
238240
{% trans submissions_left=submissions_left %}You can submit {{ submissions_left }} more solution(s).{% endtrans %}
239241
</p>
240242
</div>
241-
{% endif %}
243+
{% endif %}
242244

243245
<div id="submit_solution" class="row">
244246
<div class="span5">
245247
<form class="form-horizontal" enctype="multipart/form-data" action="{{ contest_url("tasks", task.name, "submit") }}" method="POST">
246248
{{ xsrf_form_html|safe }}
247249
<fieldset>
248-
{% for filename in task.submission_format %}
250+
{% for filename in task.submission_format %}
249251
<div class="control-group">
250252
<label class="control-label" for="input{{ loop.index0 }}">{{ filename|replace(".%l", ": ") }}</label>
251253
<div class="controls">
@@ -255,18 +257,18 @@ <h2 style="margin-bottom: 10px">{% trans %}Submit a solution{% endtrans %}</h2>
255257
$(this).parents('form').find('input[type=file]'))"/>
256258
</div>
257259
</div>
258-
{% endfor %}
259-
{% if task.submission_format|any("endswith", ".%l") %}
260+
{% endfor %}
261+
{% if task.submission_format|any("endswith", ".%l") %}
260262
<div class="control-group">
261263
<div class="controls">
262264
<select name="language">
263-
{% for lang in contest.languages %}
265+
{% for lang in contest.languages %}
264266
<option value="{{ lang }}">{{ lang }}</option>
265-
{% endfor %}
267+
{% endfor %}
266268
</select>
267269
</div>
268270
</div>
269-
{% endif %}
271+
{% endif %}
270272
<div class="control-group">
271273
<div class="controls">
272274
<button type="submit" class="btn btn-success">{% trans %}Submit{% endtrans %}</button>
@@ -276,7 +278,7 @@ <h2 style="margin-bottom: 10px">{% trans %}Submit a solution{% endtrans %}</h2>
276278
</fieldset>
277279
</form>
278280
</div>
279-
{% if task.submission_format|length > 1 and not task.submission_format|any("endswith", ".%l") %}
281+
{% if task.submission_format|length > 1 and not task.submission_format|any("endswith", ".%l") %}
280282
<div class="span4">
281283
<form class="form-horizontal" enctype="multipart/form-data" action="{{ contest_url("tasks", task.name, "submit") }}" method="POST">
282284
{{ xsrf_form_html|safe }}
@@ -296,9 +298,10 @@ <h2 style="margin-bottom: 10px">{% trans %}Submit a solution{% endtrans %}</h2>
296298
</fieldset>
297299
</form>
298300
</div>
299-
{% endif %}
301+
{% endif %}
300302
</div>
301303

304+
{% endif %}
302305

303306
<h2 style="margin: 40px 0 10px">{% trans %}Previous submissions{% endtrans %}</h2>
304307

0 commit comments

Comments
 (0)