Add UI for batch cases in status

This commit is contained in:
cuom1999 2021-05-26 12:10:19 -05:00
parent 52ba13fd51
commit 13b63d7d84
3 changed files with 110 additions and 89 deletions

View file

@ -152,8 +152,11 @@ def get_cases_data(submission):
case_data = get_problem_case(submission.problem, files)
problem_data = {}
for count, case in enumerate(testcases):
problem_data[count + 1] = {'input': case_data[case.input_file],
count = 0
for case in testcases:
if case.type != 'C': continue
count += 1
problem_data[count] = {'input': case_data[case.input_file],
'answer': case_data[case.output_file]}
return problem_data
@ -167,6 +170,7 @@ class SubmissionStatus(SubmissionDetailBase):
submission = self.object
context['last_msg'] = event.last()
context['batches'] = group_test_cases(submission.test_cases.all())
print(context['batches'])
context['time_limit'] = submission.problem.time_limit
contest = submission.contest_or_none

View file

@ -210,7 +210,6 @@ label[for="language"], label[for="status"] {
padding-left: 1em;
padding-bottom: 3px;
padding-top: 3px;
display: inline-block;
}
// .batch-cases .case-row td b {
@ -237,7 +236,7 @@ label[for="language"], label[for="status"] {
font-family: Consolas;
}
#testcases-table {
.testcases-table {
width: 100%;
border: 1px solid grey;
border-radius: 0.5em;

View file

@ -25,19 +25,10 @@
<h3>{{ _('Execution Results') }}</h3>
{% endif %}
<br>
{% set test_case_id = counter() %}
{% for batch in batches %}
{% if batch.id %}
<b>{{ _('Batch ') }}#{{ test_case_id() }}</b>
({{ _('%(points)s/%(total)s points', points=batch.points|floatformat(0), total=batch.total|floatformat(0)) }})
<br>
<div class="batch-cases">
{% endif %}
<table id="testcases-table">
{% if submission.is_graded %}
{% if submission.result != 'AB' %}
<thead>
<table class="testcases-table">
{% if submission.is_graded and submission.result != 'AB' %}
<thead>
<tr id="overall-row" class="case-row overall-result-{{submission.result}}">
<td><span class="col-title">{{_('Overall: ')}}</span>
@ -72,8 +63,32 @@
</tr>
</thead>
{% endif %}
{% endif %}
<tbody>
{% for batch in batches %}
{% if batch.id %}
{% set batch_AC = (batch.points == batch.total) %}
<tr class="case-row" style="background-color: {{ '#d6e8f7' if batch.points == batch.total else 'bisque'}}">
<td>
<b>{{ _('Batch ') }}#{{ loop.index }}</b>
</td>
<td>
{% if batch_AC %}
<span class="fa fa-check case-AC"></span>
{% else %}
<span class="fa fa-times case-WA"></span>
{% endif %}
</td>
<td>
<span class="col-title">
{{_('Point')}}:
</span>
{{ _('%(points)s/%(total)s', points=batch.points|floatformat(1), total=batch.total|floatformat(0)) }}
</td>
<td></td>
<td></td>
</tr>
{% endif %}
{% for case in batch.cases %}
<tr id="{{ case.id }}" class="case-row toggle closed">
<td>
@ -83,9 +98,9 @@
{%- if batch.id -%}
<b>{{ _('Case') }} #{{ loop.index }}:</b>
{%- elif is_pretest -%}
<b>{{ _('Pretest') }} #{{ test_case_id() }}:</b>
<b>{{ _('Pretest') }} #{{ loop.index }}:</b>
{%- else -%}
<b>{{ _('Test case') }} #{{ test_case_id() }}:</b>
<b>{{ _('Test case') }} #{{ loop.index }}:</b>
{%- endif -%}
</td>
@ -95,9 +110,14 @@
</span>
</td>
<td><span class="col-title">{{_('Point')}}: </span>
{% if not batch.id %}
<td><span class="col-title">{{_('Point')}}: </span> {{ case.points|floatformat }}/{{ case.total|floatformat(0) }}</td>
{{ case.points|floatformat }}/{{ case.total|floatformat(0) }}
{% else %}
-
{% endif %}
</td>
<td>
{%- if case.status != 'SC' -%}
@ -144,11 +164,9 @@
</tr>
{% endif %}
{% endfor %}
</table>
{% if batch.id %}</div>{% endif %}
<br>
{% endfor %}
</tbody></table>
{% if submission.is_graded %}
<br>
{% if submission.result != "AB" %}