Skip to content

Commit 5963969

Browse files
aguss787fushar
authored andcommitted
Allow contestants to view submissions after the contest ends
1 parent cb141cb commit 5963969

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

cms/server/contest/handlers/task.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TaskDescriptionHandler(ContestHandler):
4949
5050
"""
5151
@tornado_web.authenticated
52-
@actual_phase_required(0, 3)
52+
@actual_phase_required(0, 1, 2, 3, 4)
5353
@multi_contest
5454
def get(self, task_name):
5555
task = self.get_task(task_name)
@@ -64,7 +64,7 @@ class TaskStatementViewHandler(FileHandler):
6464
6565
"""
6666
@tornado_web.authenticated
67-
@actual_phase_required(0, 3)
67+
@actual_phase_required(0, 1, 2, 3, 4)
6868
@multi_contest
6969
def get(self, task_name, lang_code):
7070
task = self.get_task(task_name)
@@ -90,7 +90,7 @@ class TaskAttachmentViewHandler(FileHandler):
9090
9191
"""
9292
@tornado_web.authenticated
93-
@actual_phase_required(0, 3)
93+
@actual_phase_required(0, 1, 2, 3, 4)
9494
@multi_contest
9595
def get(self, task_name, filename):
9696
task = self.get_task(task_name)

cms/server/contest/handlers/tasksubmission.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class TaskSubmissionsHandler(ContestHandler):
110110
111111
"""
112112
@tornado_web.authenticated
113-
@actual_phase_required(0, 3)
113+
@actual_phase_required(0, 1, 2, 3, 4)
114114
@multi_contest
115115
def get(self, task_name):
116116
participation = self.current_user
@@ -225,7 +225,7 @@ def add_task_score(self, participation, task, data):
225225
task.score_precision, translation=self.translation)
226226

227227
@tornado_web.authenticated
228-
@actual_phase_required(0, 3)
228+
@actual_phase_required(0, 1, 2, 3, 4)
229229
@multi_contest
230230
def get(self, task_name, submission_num):
231231
task = self.get_task(task_name)
@@ -285,7 +285,7 @@ class SubmissionDetailsHandler(ContestHandler):
285285
refresh_cookie = False
286286

287287
@tornado_web.authenticated
288-
@actual_phase_required(0, 3)
288+
@actual_phase_required(0, 1, 2, 3, 4)
289289
@multi_contest
290290
def get(self, task_name, submission_num):
291291
task = self.get_task(task_name)
@@ -326,7 +326,7 @@ class SubmissionFileHandler(FileHandler):
326326
327327
"""
328328
@tornado_web.authenticated
329-
@actual_phase_required(0, 3)
329+
@actual_phase_required(0, 1, 2, 3, 4)
330330
@multi_contest
331331
def get(self, task_name, submission_num, filename):
332332
if not self.contest.submissions_download_allowed:

cms/server/contest/templates/contest.html

+1-1
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

+16-13
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)