Skip to content

Commit 9f87384

Browse files
Do not use "average" of token modes when looking at a specific task
Use instead the token mode of that task.
1 parent 4078ce5 commit 9f87384

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

cms/server/contest/handlers/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Contest Management System - http://cms-dev.github.io/
55
# Copyright © 2010-2014 Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
6-
# Copyright © 2010-2017 Stefano Maggiolo <s.maggiolo@gmail.com>
6+
# Copyright © 2010-2018 Stefano Maggiolo <s.maggiolo@gmail.com>
77
# Copyright © 2010-2012 Matteo Boscariol <boscarim@hotmail.com>
88
# Copyright © 2012-2018 Luca Wehrstedt <luca.wehrstedt@gmail.com>
99
# Copyright © 2013 Bernard Blackham <bernard@largestprime.net>

cms/server/contest/handlers/tasksubmission.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def get(self, task_name):
162162
download_allowed = self.contest.submissions_download_allowed
163163
self.render("task_submissions.html",
164164
task=task, submissions=submissions,
165+
tokens_task=task.token_mode,
165166
tokens_info=tokens_info,
166167
submissions_left=submissions_left,
167168
submissions_download_allowed=download_allowed,

cms/server/contest/templates/submission_row.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
{% endif %}
9797
</td>
9898
{% endif %}
99-
{% if tokens_contest != TOKEN_MODE_DISABLED and tokens_tasks != TOKEN_MODE_DISABLED and actual_phase == 0 %}
99+
{% if tokens_contest != TOKEN_MODE_DISABLED and tokens_task != TOKEN_MODE_DISABLED and actual_phase == 0 %}
100100
<td class="token">
101101
{% if s.token is not none %}
102102
<a class="btn disabled">{% trans %}Played{% endtrans %}</a>

cms/server/contest/templates/task_submissions.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ <h2 style="margin: 40px 0 10px">{% trans %}Previous submissions{% endtrans %}</h
188188
<div style="padding-bottom:10px">
189189
{% set can_play_token = actual_phase == 0 and (tokens_info[0] > 0 or tokens_info[0] == -1) %}
190190
{% set need_to_wait = tokens_info[2] is not none %}
191-
{% if can_play_token %}
191+
{% if tokens_task == TOKEN_MODE_DISABLED %}
192+
{% trans %}Tokens are not allowed on this task.{% endtrans %}
193+
{% elif can_play_token %}
192194
{% if tokens_info[0] == -1 %}
193195
{% trans %}Right now, you have infinite tokens available on this task.{% endtrans %}
194196
{% elif tokens_info[0] == 1 %}
@@ -259,7 +261,7 @@ <h2 style="margin: 40px 0 10px">{% trans %}Previous submissions{% endtrans %}</h
259261
<col class="files"/>
260262
{% set num_cols = num_cols + 1 %}
261263
{% endif %}
262-
{% if tokens_contest != TOKEN_MODE_DISABLED and tokens_tasks != TOKEN_MODE_DISABLED and actual_phase == 0 %}
264+
{% if tokens_contest != TOKEN_MODE_DISABLED and tokens_task != TOKEN_MODE_DISABLED and actual_phase == 0 %}
263265
<col class="token"/>
264266
{% set num_cols = num_cols + 1 %}
265267
{% endif %}
@@ -286,7 +288,7 @@ <h2 style="margin: 40px 0 10px">{% trans %}Previous submissions{% endtrans %}</h
286288
{% if submissions_download_allowed %}
287289
<th class="files">{% trans %}Files{% endtrans %}</th>
288290
{% endif %}
289-
{% if tokens_contest != TOKEN_MODE_DISABLED and tokens_tasks != TOKEN_MODE_DISABLED and actual_phase == 0 %}
291+
{% if tokens_contest != TOKEN_MODE_DISABLED and tokens_task != TOKEN_MODE_DISABLED and actual_phase == 0 %}
290292
<th class="token">{% trans %}Token{% endtrans %}</th>
291293
{% endif %}
292294
</tr>

0 commit comments

Comments
 (0)