core: simplify contest & homework logic

This commit is contained in:
undefined committed 2022-07-10 22:12:18 +08:00
1 parent 81518ab424
commit 08462cf870
14 files changed
+143 -218

No files matched your search

@@ -30,6 +30,11 @@
<p>{{ _('We will check code similarity after this contest.') }}</p>
</blockquote>
{% endif %}
{% if tdoc.duration %}
<blockquote class="note">
<p>{{ _('The contest is a flexible time contest. You need to complete the contest within a specified time after you attended.') }}</p>
</blockquote>
{% endif %}
</div>
</div>
{% if model.contest.isOngoing(tdoc, tsdoc) or model.contest.isDone(tdoc, tsdoc) %}
@@ -1,6 +1,6 @@
{% import "components/paginator.html" as paginator with context %}
{% extends "layout/basic.html" %}
{% set type = 'homework' if tdoc.docType == 60 else 'contest' %}
{% set type = 'homework' if tdoc.rule == 'homework' else 'contest' %}
{% block content %}
<div class="row"><div class="medium-12 columns scoreboard--{{ tdoc.rule }}">
<div class="section visible">
@@ -109,7 +109,7 @@
<dt>{{ _('Rule') }}</dt><dd>{{ model.contest.RULES[tdoc.rule].TEXT }}</dd>
<dt>{{ _('Problem') }}</dt><dd>{{ tdoc.pids.length }}</dd>
<dt>{{ _('Start at') }}</dt><dd>{{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }}</dd>
<dt>{{ _('End at') }}</dt><dd>{{ contest.render_time(tdoc.endAt) }}</dd>
<dt>{{ _('End at') }}</dt><dd>{{ contest.render_time(tsdoc.endAt or tdoc.endAt) }}</dd>
<dt>{{ _('Duration') }}</dt><dd>{{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}</dd>
<dt>{{ _('Host') }}</dt><dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
<dt>{{ _('Partic.') }}</dt><dd>{{ tdoc['attend']|default(0) }}</dd>