judge&ui: support show single subtask score (#529)

This commit is contained in:
panda authored and GitHub committed 2023-03-05 12:29:50 +08:00
1 parent 8b2a9f0847
commit 69e7f9d107
3 files changed
+9 -7

No files matched your search

+1
View File
@@ -64,6 +64,7 @@ function judgeSubtask(subtask: NormalizedSubtask, sid: string, judgeCase: Task['
}
ctx.total_status = Math.max(ctx.total_status, ctxSubtask.status);
return {
type: ctxSubtask.subtask.type,
score: ctxSubtask.score,
status: ctxSubtask.status,
};
+1
View File
@@ -549,6 +549,7 @@ export interface JudgeMessage {
}
export interface SubtaskResult {
type: SubtaskType;
score: number;
status: number;
}
@@ -18,8 +18,7 @@
<pre class="judge-text">{{ formatJudgeTexts(rdoc.judgeTexts)|ansi|safe }}</pre>
</div>
{% endif %}
{% if rdoc.testCases.length %}
{% set _key = 'id' if rdoc.testCases|groupby('subtaskId')|length == 1 else 'subtaskId' %}
{% if rdoc.testCases.length %}
<div class="section__body no-padding">
<table class="data-table record_detail__table">
<colgroup>
@@ -33,7 +32,7 @@
<th class="col--case record-status--border">#</th>
<th class="col--status">
{{ _('Status') }}
{% if rdoc.subtasks and _key != 'id' %}
{% if rdoc.subtasks and (rdoc.subtasks|length > 1 or rdoc.subtasks[Object.keys(rdoc.subtasks)[0]].type == 'sum') %}
<span class="float-right">{{ _('Score') }}</span>
{% endif %}
</th>
@@ -42,6 +41,7 @@
</tr>
</thead>
<tbody>
{% set _key = 'id' if rdoc.testCases|groupby('subtaskId')|length == 1 else 'subtaskId' %}
{%- for subtaskId, rcdocs in rdoc.testCases|sort(false,false,_key)|groupby(_key) -%}
{% if rcdocs.length > 1 %}
<tr class="subtask">
@@ -52,7 +52,7 @@
<td class="col--status">
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc.subtasks[subtaskId]['status']] }}"></span>
<span class="record-status--text {{ model.builtin.STATUS_CODES[rdoc.subtasks[subtaskId]['status']] }}">
{{ model.builtin.STATUS_TEXTS[rcdocs[0]['status']] }}
{{ model.builtin.STATUS_TEXTS[rdoc.subtasks[subtaskId]['status']] }}
</span>
<span class="float-right record-status--text {{ model.builtin.STATUS_CODES[rdoc.subtasks[subtaskId]['status']] }}">{{ rdoc.subtasks[subtaskId]['score']|default(0) }}</span>
</td>
@@ -71,9 +71,9 @@
<span class="record-status--text {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
{{ model.builtin.STATUS_TEXTS[rcdoc['status']] }}
</span>
{% if rcdocs.length == 1 and _key != 'id' %}
<span class="float-right record-status--text {{ model.builtin.STATUS_CODES[rdoc.subtasks[subtaskId]['status']] }}">
{{ rdoc.subtasks[subtaskId]['score']|default(0) }}
{% if (_key != 'id' and rcdocs.length == 1) or (_key == 'id' and rdoc.subtasks[rcdoc.subtaskId].type == 'sum') %}
<span class="float-right record-status--text {{ model.builtin.STATUS_CODES[rdoc.subtasks[subtaskId]['status'] if _key != 'id' else rcdoc.status] }}">
{{ (rdoc.subtasks[subtaskId]['score'] if _key != 'id' else rcdoc.score)|default(0) }}
</span>
{% endif %}
<span>{{ formatJudgeTexts([rcdoc.message]) if rcdoc.message else '' }}</span>