mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
比赛功能也太难写了
This commit is contained in:
1 parent
f73859a42f
commit
32ad47e031
16 files changed
+195
-176
No files matched your search
@@ -1,8 +1,8 @@
|
||||
{% import "components/user.html" as user with context %}
|
||||
{% macro render_time(tdoc_time) %}
|
||||
{{ datetime_span(tdoc_time, false, '%Y-%m-%d %H:%M') }}
|
||||
{{ datetime_span(tdoc_time, false, '%Y-%m-%d %H:%M')|safe }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_duration(tdoc) %}
|
||||
{{ ((tdoc['end_at'] - tdoc['begin_at']).total_seconds() / 3600)|round(1) }}
|
||||
{{ ((tdoc.endAt.getTime() - tdoc.beginAt.getTime()) /1000 / 3600)|round(1) }}
|
||||
{% endmacro %}
|
||||
@@ -1,3 +1,4 @@
|
||||
{% set page_name = "contest_detail" %}
|
||||
{% extends "layout/basic.html" %}
|
||||
{% import "components/contest.html" as contest with context %}
|
||||
{% import "components/record.html" as record with context %}
|
||||
@@ -7,20 +8,20 @@
|
||||
<div class="medium-9 columns">
|
||||
<div class="section">
|
||||
<div class="section__body typo">
|
||||
{{ tdoc['content']|markdown }}
|
||||
{% if handler.is_ongoing(tdoc) %}
|
||||
{{ tdoc['content']|markdown|safe }}
|
||||
{% if model.contest.is_ongoing(tdoc) %}
|
||||
<blockquote class="warn">
|
||||
<p>{{ _('We will check code similarity after this contest.') }}</p>
|
||||
</blockquote>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if handler.is_ongoing(tdoc) or handler.is_done(tdoc) %}
|
||||
{% if model.contest.is_ongoing(tdoc) or model.contest.is_done(tdoc) %}
|
||||
<div class="section">
|
||||
<div class="section__header">
|
||||
<h1 class="section__title">{{ _('Problem') }}</h1>
|
||||
</div>
|
||||
{% if attended or handler.is_done(tdoc) %}
|
||||
{% if attended or model.contest.is_done(tdoc) %}
|
||||
<div class="section__body no-padding">
|
||||
<table class="data-table">
|
||||
<colgroup>
|
||||
@@ -40,18 +41,17 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pid in tdoc['pids'] %}
|
||||
{% for pid in tdoc.pids %}
|
||||
<tr>
|
||||
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
{% if psdict[pid] and psdict[pid]['rid'] %}
|
||||
{% with rdoc=rdict[psdict[pid]['rid']] %}
|
||||
{% if psdict[pid] and psdict[pid].rid %}
|
||||
{% set rdoc = rdict[psdict[pid].rid] %}
|
||||
{% if handler.can_show_record(tdoc) %}
|
||||
{{ record.render_status_td(rdoc) }}
|
||||
{% else %}
|
||||
<td class="col--status record-status--border"><a href="/r/{{ rdoc._id }}">{{ _('Submitted') }}</a></td>
|
||||
{% endif %}
|
||||
<td class="col--submit-at">{{ datetime_span(rdoc['_id'].generationTime) }}</td>
|
||||
{% endwith %}
|
||||
<td class="col--submit-at">{{ datetime_span(rdoc._id) }}</td>
|
||||
{% else %}
|
||||
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
|
||||
<td class="col--submit-at">-</td>
|
||||
@@ -73,9 +73,8 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="medium-3 columns">
|
||||
{% with owner_udoc=udict[tdoc['owner_uid']], owner_dudoc=dudict[tdoc['owner_uid']] %}
|
||||
{% include "partials/contest_sidebar.html" %}
|
||||
{% endwith %}
|
||||
{% set owner_udoc = udict[tdoc.owner] %}
|
||||
{% include "partials/contest_sidebar.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -17,11 +17,11 @@
|
||||
</li>
|
||||
<li>
|
||||
<span class="icon icon-calendar"></span>
|
||||
{{ _('Start at') }}: {{ model.contest.render_time(tdoc['beginAt']) }}
|
||||
{{ _('Start at') }}: {{ contest.render_time(tdoc.beginAt) }}
|
||||
</li>
|
||||
<li>
|
||||
<span class="icon icon-schedule--fill"></span>
|
||||
{{ _('Duration') }}: {{ model.contest.render_duration(tdoc) }} {{ _('hour(s)') }}
|
||||
{{ _('Duration') }}: {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
|
||||
</li>
|
||||
<li>
|
||||
<span class="icon icon-user--multiple"></span>
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<div class="media__right middle">
|
||||
<div class="section__body">
|
||||
<a href="/t/{{ tdoc._id }}" class="detail-button">{{ _('View Details') }}</a>
|
||||
<a href="/c/{{ tdoc._id }}" class="detail-button">{{ _('View Details') }}</a>
|
||||
<div class="typo text-center">
|
||||
{% if tsdict[tdoc._id].attend %}
|
||||
<p><span class="icon icon-check"></span> {{ _('Attended') }}</p>
|
||||
@@ -49,9 +49,9 @@
|
||||
<div class="row">
|
||||
<div class="medium-9 columns">
|
||||
{% for tdoc in tdocs %}
|
||||
{% if handler.is_ongoing(tdoc) %}
|
||||
{% if model.contest.is_ongoing(tdoc) %}
|
||||
{{ render_important_contest('live', 'Live...', tdoc) }}
|
||||
{% elif handler.is_upcoming(tdoc) %}
|
||||
{% elif model.contest.is_upcoming(tdoc) %}
|
||||
{{ render_important_contest('ready', 'Ready (☆▽☆)', tdoc) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -83,12 +83,12 @@
|
||||
<div class="media">
|
||||
<div class="media__left medium">
|
||||
<div class="contest__date numbox">
|
||||
<div class="numbox__num large">{{ datetime_span(tdoc['beginAt'], false, '%d') }}</div>
|
||||
<div class="numbox__text">{{ datetime_span(tdoc['beginAt'], false, '%Y-%m') }}</div>
|
||||
<div class="numbox__num large">{{ datetime_span(tdoc['beginAt'], false, '%d')|safe }}</div>
|
||||
<div class="numbox__text">{{ datetime_span(tdoc['beginAt'], false, '%Y-%m')|safe }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="media__body medium">
|
||||
<h1 class="contest__title"><a href="/t/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<h1 class="contest__title"><a href="/c/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<ul class="supplementary list">
|
||||
<li>
|
||||
<a href="?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ model.contest.RULES[tdoc.rule].TEXT }}</a>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="media__body medium">
|
||||
<h1 class="contest__title"><a href="/t/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<h1 class="contest__title"><a href="/c/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<ul class="supplementary list">
|
||||
<li>
|
||||
<a href="{{ reverse_url('contest_main') }}?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ vj4.constant.contest.RULE_TEXTS[tdoc['rule']] }}</a>
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
</div>
|
||||
<div class="error__text-container">
|
||||
<h1>{{ _('Oops!') }}</h1>
|
||||
<p>{{ _(error.message).format(error.args) }}</p>
|
||||
<p>{{ _(error.message).format(error.params) }}</p>
|
||||
<p>{{ _('Technical Information') }}:</p>
|
||||
<p>{{ _('Type') }}: {{ error.code }}</p>
|
||||
<p>{{ _('Arguments') }}:
|
||||
<ol>
|
||||
{% for arg in error.args %}
|
||||
<li>{{ arg }}</li>
|
||||
{% for param in error.params %}
|
||||
<li>{{ param }}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{% import "components/contest.html" as contest with context %}
|
||||
<div class="section side">
|
||||
{% if page_name != 'contest_detail' %}
|
||||
<a class="contest-sidebar__bg" href="/t/{{ tdoc._id }}">
|
||||
<a class="contest-sidebar__bg" href="/c/{{ tdoc._id }}">
|
||||
<div class="section__body">
|
||||
<h1>{{ tdoc['title'] }}</h1>
|
||||
<div class="contest-sidebar__status">
|
||||
@@ -17,31 +17,15 @@
|
||||
{% endif %}
|
||||
<div>
|
||||
<ol class="menu">
|
||||
{% if page_name == 'discussion_node' %}
|
||||
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
|
||||
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=tdoc['doc_type'], doc_id=tdoc['doc_id']) }}">
|
||||
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
|
||||
</a></li>
|
||||
{% else %}
|
||||
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
|
||||
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
|
||||
{% else %}
|
||||
<li class="menu__item"><a class="menu__link disabled" href="javascript:;">
|
||||
<span class="icon icon-add"></span> {{ _('No Permission to Create a Discussion') }}</a></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li class="menu__seperator"></li>
|
||||
{% endif %}
|
||||
{% if page_name != 'contest_detail' %}
|
||||
<li class="menu__item"><a class="menu__link" href="/t/{{ tdoc._id }}">
|
||||
<li class="menu__item"><a class="menu__link" href="/c/{{ tdoc._id }}">
|
||||
<span class="icon icon-award"></span> {{ _('View Contest') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if not attended and not handler.is_done(tdoc) %}
|
||||
{% if not attended and not model.contest.is_done(tdoc) %}
|
||||
<li class="menu__item">
|
||||
{% if handler.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<form action="/t/{{ tdoc._id }}" method="POST">
|
||||
<form action="/c/{{ tdoc._id }}" method="POST">
|
||||
<input type="hidden" name="operation" value="attend">
|
||||
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
|
||||
<button class="menu__link" type="submit">
|
||||
@@ -59,26 +43,26 @@
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if handler.can_show_scoreboard(tdoc, False) %}
|
||||
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_scoreboard', tid=tdoc['doc_id']) }}">
|
||||
{% if handler.canShowScoreboard(tdoc, False) %}
|
||||
<li class="menu__item"><a class="menu__link" href="/c/{{ tdoc._id }}/scoreboard">
|
||||
<span class="icon icon-statistics"></span> {{ _('Scoreboard') }}
|
||||
</a></li>
|
||||
{% elif handler.can_view_hidden_scoreboard(tdoc) %}
|
||||
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_scoreboard', tid=tdoc['doc_id']) }}">
|
||||
{% elif handler.canViewHiddenScoreboard(tdoc) %}
|
||||
<li class="menu__item"><a class="menu__link" href="/c/{{ tdoc._id }}/scoreboard">
|
||||
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.hasPerm(perm.PERM_EDIT_CONTEST) %}
|
||||
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_edit', tid=tdoc['doc_id']) }}">
|
||||
{% if user._id == tdoc.owner or handler.hasPerm(perm.PERM_EDIT_CONTEST) %}
|
||||
<li class="menu__item"><a class="menu__link" href="/c/{{ tdoc._id }}/edit">
|
||||
<span class="icon icon-edit"></span> {{ _('Edit Contest') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if handler.hasPerm(perm.PERM_READ_RECORD_CODE) %}
|
||||
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_code', tid=tdoc['doc_id']) }}">
|
||||
<li class="menu__item"><a class="menu__link" href="/c/{{ tdoc._id }}/code">
|
||||
<span class="icon icon-download"></span> {{ _('Export All Code') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
<li class="menu__item"><a class="menu__link" href="/r?tid={{ tdoc['doc_id'] }}">
|
||||
<li class="menu__item"><a class="menu__link" href="/r?tid={{ tdoc._id }}">
|
||||
<span class="icon icon-flag"></span> {{ _('All Submissions') }}
|
||||
</a></li>
|
||||
<li class="menu__item"><a class="menu__link" href="/wiki/help#contest">
|
||||
@@ -89,13 +73,13 @@
|
||||
</div>
|
||||
<div class="section__body typo">
|
||||
<dl class="large horizontal">
|
||||
<dt>{{ _('Status') }}</dt><dd>{{ _(handler.status_text(tdoc)) }}</dd>
|
||||
<dt>{{ _('Rule') }}</dt><dd>{{ vj4.constant.contest.RULE_TEXTS[tdoc['rule']] }}</dd>
|
||||
<dt>{{ _('Problem') }}</dt><dd>{{ tdoc['pids']|length }}</dd>
|
||||
<dt>{{ _('Start at') }}</dt><dd>{{ contest.render_time(tdoc['begin_at']) }}</dd>
|
||||
<dt>{{ _('End at') }}</dt><dd>{{ contest.render_time(tdoc['end_at']) }}</dd>
|
||||
<dt>{{ _('Status') }}</dt><dd>{{ _(model.contest.status_text(tdoc)) }}</dd>
|
||||
<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(tdoc.beginAt) }}</dd>
|
||||
<dt>{{ _('End at') }}</dt><dd>{{ contest.render_time(tdoc.endAt) }}</dd>
|
||||
<dt>{{ _('Duration') }}</dt><dd>{{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}</dd>
|
||||
<dt>{{ _('Host') }}</dt><dd>{{ user.render_inline(owner_udoc, dudoc=owner_dudoc, badge=false) }}</dd>
|
||||
<dt>{{ _('Host') }}</dt><dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
|
||||
<dt>{{ _('Partic.') }}</dt>
|
||||
<dd>
|
||||
{{ tdoc['attend']|default(0) }}
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
{% if ctdocs %}
|
||||
<p>{{ _('In following contests') }}: </p>
|
||||
{% for tdoc in ctdocs %}
|
||||
<p><a href="/t/{{ tdoc._id }}">{{ tdoc['title'] }}</a></p>
|
||||
<p><a href="/c/{{ tdoc._id }}">{{ tdoc['title'] }}</a></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if htdocs %}
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
{% if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %}
|
||||
<dt>{{ _('Contest') }}</dt>
|
||||
<dd>
|
||||
<a href="/t/{{ tdoc._id }}">{{ tdoc['title'] }}</a>
|
||||
<a href="/c/{{ tdoc._id }}">{{ tdoc['title'] }}</a>
|
||||
</dd>
|
||||
{% else %}{# tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST #}
|
||||
<dt>{{ _('Homework') }}</dt>
|
||||
|
||||
Reference in new issue
Block a user