Add contest tester/curator (DMOJ)

This commit is contained in:
cuom1999 2021-05-24 15:00:36 -05:00
parent 06318a97e5
commit 297b8a2a36
25 changed files with 611 additions and 230 deletions

View file

@ -2,21 +2,21 @@
{% block tabs %}
{{ make_tab('detail', 'fa-info-circle', url('contest_view', contest.key), _('Info')) }}
{% if contest.ended or contest.is_editable_by(request.user) %}
{% if contest.ended or can_edit %}
{{ make_tab('stats', 'fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %}
{% if contest.start_time <= now or perms.judge.see_private_contest %}
{% if contest.show_scoreboard or contest.can_see_scoreboard(request.user) %}
{% if contest.can_see_own_scoreboard(request.user) %}
{{ make_tab('ranking', 'fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }}
{% if request.user.is_authenticated %}
{{ make_tab('participation', 'fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
{% else %}
{{ make_tab('ranking', 'fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% if contest.show_scoreboard and request.user.is_authenticated %}
{{ make_tab('participation', 'fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
{% endif %}
{% if contest.is_editable_by(request.user) %}
{% if can_edit %}
{% if perms.judge.moss_contest and has_moss_api_key %}
{{ make_tab('moss', 'fa-gavel', url('contest_moss', contest.key), _('MOSS')) }}
{% endif %}
@ -27,17 +27,18 @@
{% endif %}
{% if request.user.is_authenticated %}
{% if contest.can_join or participating or is_organizer %}
{% if contest.can_join or is_editor or is_tester %}
{% set in_contest = contest.is_in_contest(request.user) %}
{% if contest.ended %}
{# Allow users to leave the virtual contest #}
{% if in_contest %}
{# They're in the contest because they're participating virtually #}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" class="leaving-forever" value="{{ _('Leave contest') }}">
</form>
{% else %}
{# They're in the contest because they're participating virtually #}
{# Allow users to virtual join #}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
@ -45,35 +46,30 @@
</form>
{% endif %}
{% else %}
{# Allow users to leave the contest #}
{% if in_contest %}
{# Allow people with ended participations to continue spectating #}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" value="
{%- if participating and participation.ended or request.profile in contest.organizers.all() %}
{%- if request.participation.spectate %}
{{- _('Stop spectating') -}}
{% else %}
{{- _('Leave contest') -}}
{% endif %}">
</form>
{% elif participating and participation.ended or is_organizer %}
{% elif is_editor or is_tester or live_participation.ended %}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" value="{{ _('Spectate contest') }}">
</form>
{% elif participating %}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" value="{{ _('Join contest') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" class="first-join" value="{{ _('Join contest') }}">
<input type="submit" {% if not has_joined %}class="first-join"{% endif %}
value="{{ _('Join contest') }}">
</form>
{% endif %}
{% endif %}

View file

@ -28,11 +28,11 @@
<div id="banner">
<a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg={{ contest.name|urlquote('') }}&amp;iso=
{{- contest.start_time|utc|date('Y-m-d\TH:i:s') }}" class="date">
{%- if participating and participation.virtual and not participation.ended -%}
{% if participation.spectate %}
{%- if contest.is_in_contest(request.user) and not request.participation.live -%}
{% if request.participation.spectate %}
{{- _('Spectating, contest ends in %(countdown)s.', countdown=contest.time_before_end|as_countdown) -}}
{% elif participation.end_time %}
{{- _('Participating virtually, %(countdown)s remaining.', countdown=participation.time_remaining|as_countdown) -}}
{% elif request.participation.end_time %}
{{- _('Participating virtually, %(countdown)s remaining.', countdown=request.participation.time_remaining|as_countdown) -}}
{% else %}
{{- _('Participating virtually.') -}}
{% endif %}
@ -42,11 +42,11 @@
{% elif contest.end_time < now %}
{{- _('Contest is over.') -}}
{% else %}
{%- if participating -%}
{% if participation.ended %}
{%- if has_joined -%}
{% if live_participation.ended %}
{{- _('Your time is up! Contest ends in %(countdown)s.', countdown=contest.time_before_end|as_countdown) -}}
{% else %}
{{- _('You have %(countdown)s remaining.', countdown=participation.time_remaining|as_countdown) -}}
{{- _('You have %(countdown)s remaining.', countdown=live_participation.time_remaining|as_countdown) -}}
{% endif %}
{%- else -%}
{{ _('Contest ends in %(countdown)s.', countdown=contest.time_before_end|as_countdown) }}
@ -73,7 +73,7 @@
{% endcache %}
</div>
{% if contest.ended or request.user.is_superuser or is_organizer %}
{% if contest.ended or request.user.is_superuser or is_editor or is_tester %}
<hr>
<div class="contest-problems">
<h2 style="margin-bottom: 0.2em"><i class="fa fa-fw fa-question-circle"></i>{{ _('Problems') }} </h2>

View file

@ -185,7 +185,7 @@
{% endmacro %}
{% macro user_count(contest, user) %}
{% if contest.show_scoreboard or contest.can_see_scoreboard(user) %}
{% if contest.can_see_own_scoreboard(user) %}
<a href="{{ url('contest_ranking', contest.key) }}">{{ contest.user_count }}</a>
{% else %}
{{ contest.user_count }}
@ -195,7 +195,7 @@
{% macro contest_join(contest, request) %}
{% if not request.in_contest %}
<td>
{% if request.profile in contest.organizers.all() %}
{% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
<form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full participate-button"

View file

@ -32,7 +32,7 @@
{% endblock %}
{% block user_data %}
{% if is_organizer %}
{% if can_edit %}
<span class="contest-participation-operation">
<form action="{{ url('contest_participation_disqualify', contest.key) }}" method="post">
{% csrf_token %}
@ -56,7 +56,7 @@
{% block before_point_head %}
{% for problem in problems %}
<th class="points header problem-score-col"><a href="{{ url('contest_ranked_submissions', contest.key, problem.problem.code) }}">
{{- loop.index }}
{{- contest.get_label_for_problem(loop.index0) }}
<div class="point-denominator">{{ problem.points }}</div>
</a></th>
{% endfor %}

View file

@ -179,7 +179,7 @@
{% endblock %}
{% block users_js_media %}
{% if is_organizer %}
{% if can_edit %}
<script type="text/javascript">
$(function () {
$('a.disqualify-participation').click(function (e) {
@ -349,7 +349,7 @@
{% block users_table %}
<div style="margin-bottom: 0.5em">
{% if tab == 'participation' %}
{% if contest.start_time <= now or perms.judge.see_private_contest %}
{% if contest.can_see_full_scoreboard(request.user) %}
<input id="search-contest" type="text" placeholder="{{ _('View user participation') }}">
{% endif %}
{% endif %}