core: allow user to manually end contest early (#1147)

This commit is contained in:
Baoshuo authored and GitHub committed 2026-04-28 04:26:02 +08:00
1 parent d8a5716a22
commit 125c4b2388
9 files changed
+99 -40

No files matched your search

@@ -68,6 +68,16 @@
<li class="menu__item"><a class="menu__link" href="{{ url('contest_problemlist', tid=tdoc.docId) }}">
<span class="icon icon-unordered_list"></span> {{ _('Problem List') }}
</a></li>
{% if page_name == 'contest_detail' and tsdoc.attend and model.contest.isOngoing(tdoc, tsdoc) and tdoc.rule !== 'homework' %}
<li class="menu__item">
<form action="{{ url('contest_detail', tid=tdoc.docId) }}" method="POST" onsubmit='return confirm({{ _("Confirm end contest early? You will not be able to submit after this.")|json|safe }});'>
<input type="hidden" name="operation" value="early_end">
<button class="menu__link" type="submit">
<span class="icon icon-delete"></span> {{ _('End Contest Early') }}
</button>
</form>
</li>
{% endif %}
{% endif %}{# not attend and not done #}
{% if model.contest.canShowScoreboard.call(handler, tdoc, False) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_scoreboard', tid=tdoc.docId) }}">
@@ -10,7 +10,10 @@
<td class="col--rank">{{ _('UnRank') if tsdoc.unrank else _('Rank') }}</td>
<td class="col--actions">
<a name="edit_rank" data-uid="{{ tsdoc.uid }}">{{ _('Rank') if tsdoc.unrank else _('UnRank') }}</a>
{% if tsdoc.endAt and tsdoc.endAt < tdoc.endAt and tdoc.endAt.getTime() > Date.now() and (not tdoc.duration or not tsdoc.startAt or tsdoc.startAt.getTime() + tdoc.duration * 3600000 > Date.now()) %}
| <a name="resume_contest" data-uid="{{ tsdoc.uid }}">{{ _('Resume') }}</a>
{% endif %}
</td>
</tr>
{%- endfor -%}
</tbody>
</tbody>