mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add contest score ratio (#765)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
9013c4eaa6
commit
e25db178fd
11 files changed
+121
-23
No files matched your search
@@ -1,4 +1,4 @@
|
||||
{% macro render_status_td(rdoc, rid_key='_id', class='', allDomain=false, short=false) %}
|
||||
{% macro render_status_td(rdoc, rid_key='_id', class='', allDomain=false, short=false, displayScore) %}
|
||||
<td class="col--status record-status--border {{ class }} {{ model.builtin.STATUS_CODES[rdoc.status] }}">
|
||||
<div class="col--status__text">
|
||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc.status] }}"></span>
|
||||
@@ -7,7 +7,7 @@
|
||||
class="record-status--text {{ model.builtin.STATUS_CODES[rdoc.status] }}"
|
||||
>
|
||||
{% if typeof(rdoc['score']) == 'number' %}
|
||||
<span style="color: {{ utils.status.getScoreColor(rdoc.score|default(0)) }}">{{ rdoc.score|default(0) }}</span>
|
||||
<span style="color: {{ utils.status.getScoreColor(rdoc.score|default(0)) }}">{{ displayScore|default(rdoc.score|default(0)) }}</span>
|
||||
{% endif %}
|
||||
{{ model.builtin.STATUS_SHORT_TEXTS[rdoc.status] if short else model.builtin.STATUS_TEXTS[rdoc.status] }}
|
||||
</a>
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
<table class="data-table">
|
||||
<colgroup>
|
||||
<col class="col--problem">
|
||||
<col class="col--score">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col--problem">{{ _('Problem') }}</th>
|
||||
<th class="col--score">{{ _('Score') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -25,6 +27,9 @@
|
||||
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, invalid=true, alphabetic=true) }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="col--score">
|
||||
<a class="typo-a" data-tooltip="{{ _('Set Score for Contest') }}" name="set_score" data-pid="{{ pid }}" data-score="{{ tdoc.score[pid]|default(100) }}">{{ tdoc.score[pid]|default(100) }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{%- endfor -%}
|
||||
</tbody>
|
||||
|
||||
@@ -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) }}
|
||||
|
||||
Reference in new issue
Block a user