core: add contest score ratio (#765)

Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
undefinedandpanda authored and GitHub committed 2024-04-01 19:25:18 +08:00
1 parent 9013c4eaa6
commit e25db178fd
11 files changed
+121 -23

No files matched your search

@@ -17,6 +17,9 @@
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
{% if showScore %}
<col class="col--score">
{% endif %}
<col class="col--problem">
</colgroup>
@@ -25,6 +28,9 @@
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
{% if showScore %}
<th class="col--score">{{ _('Score') }}</th>
{% endif %}
<th class="col--problem">{{ _('Problem') }}</th>
</tr>
@@ -34,17 +40,21 @@
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if model.contest.canShowSelfRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% set displayScore = ((tdoc.score[pid]|default(100)) * (psdict[pid].score|default(0)) / 100) if showScore else (psdict[pid].penaltyScore|default(psdict[pid].score)) %}
{% if model.contest.canShowSelfRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc, displayScore=displayScore) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc._id)|safe }}</td>
{% else %}
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
{% endif %}
{% if showScore %}
<td class="col--score">{{ tdoc.score[pid]|default(100) }}</td>
{% endif %}
<td class="col--problem col--problem-name">
{{ problem.render_problem_title(pdict[pid], tdoc, alphabetic=true) }}