From 13b63d7d84d6d86dc4198afda04ef12197367b98 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 26 May 2021 12:10:19 -0500 Subject: [PATCH] Add UI for batch cases in status --- judge/views/submission.py | 8 +- resources/submission.scss | 3 +- templates/submission/status-testcases.html | 188 +++++++++++---------- 3 files changed, 110 insertions(+), 89 deletions(-) diff --git a/judge/views/submission.py b/judge/views/submission.py index 68176be..d130062 100644 --- a/judge/views/submission.py +++ b/judge/views/submission.py @@ -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 diff --git a/resources/submission.scss b/resources/submission.scss index ea71252..c66a718 100644 --- a/resources/submission.scss +++ b/resources/submission.scss @@ -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; diff --git a/templates/submission/status-testcases.html b/templates/submission/status-testcases.html index f37eb79..01462da 100644 --- a/templates/submission/status-testcases.html +++ b/templates/submission/status-testcases.html @@ -25,55 +25,70 @@

{{ _('Execution Results') }}

{% endif %}
- {% set test_case_id = counter() %} + + + {% if submission.is_graded and submission.result != 'AB' %} + + + + + + + + + + + + + + + {% endif %} + + {% for batch in batches %} {% if batch.id %} - {{ _('Batch ') }}#{{ test_case_id() }} - ({{ _('%(points)s/%(total)s points', points=batch.points|floatformat(0), total=batch.total|floatformat(0)) }}) -
-
+ {% set batch_AC = (batch.points == batch.total) %} +
+ + + + + + {% endif %} -
{{_('Overall: ')}} + {% if request.in_contest and submission.contest_or_none %} + {% with contest=submission.contest_or_none %} + ({{ _('%(points)s/%(total)s points', points=contest.points|roundfloat(3), + total=contest.problem.points|floatformat(-1)) }}) + {% endwith %} + {% else %} + {{ _('%(points)s/%(total)s', points=submission.points|roundfloat(3), + total=submission.problem.points|floatformat(-1)) }} + {% endif %} + {{submission.long_status}}{{_('Point: ')}} + {{ submission.case_points|floatformat(1) }}/{{ submission.case_total|floatformat(0) }} + + {{_('Time: ')}} + {% if submission.result == "TLE" %} + --- + {% else %} + {{ (submission.time * 1000)|floatformat(0) }} ms + {% endif %} + + {{_('Memory: ')}}{{ submission.memory|kbdetailformat }}
+ {{ _('Batch ') }}#{{ loop.index }} + + {% if batch_AC %} + + {% else %} + + {% endif %} + + + {{_('Point')}}: + + {{ _('%(points)s/%(total)s', points=batch.points|floatformat(1), total=batch.total|floatformat(0)) }} +
- {% if submission.is_graded %} - {% if submission.result != 'AB' %} - - - - - - - - - - - - - - - - {% endif %} - {% endif %} - {% for case in batch.cases %} @@ -95,9 +110,14 @@ - {% if not batch.id %} - - {% endif %} + + - {% if ((prefix_length is none or prefix_length > 0) or (request.user.is_superuser)) %} - - + - - {% endif %} - {% endfor %} -
{{_('Overall: ')}} - {% if request.in_contest and submission.contest_or_none %} - {% with contest=submission.contest_or_none %} - ({{ _('%(points)s/%(total)s points', points=contest.points|roundfloat(3), - total=contest.problem.points|floatformat(-1)) }}) - {% endwith %} - {% else %} - {{ _('%(points)s/%(total)s', points=submission.points|roundfloat(3), - total=submission.problem.points|floatformat(-1)) }} - {% endif %} - {{submission.long_status}}{{_('Point: ')}} - {{ submission.case_points|floatformat(1) }}/{{ submission.case_total|floatformat(0) }} - - {{_('Time: ')}} - {% if submission.result == "TLE" %} - --- - {% else %} - {{ (submission.time * 1000)|floatformat(0) }} ms - {% endif %} - - {{_('Memory: ')}}{{ submission.memory|kbdetailformat }}
@@ -83,9 +98,9 @@ {%- if batch.id -%} {{ _('Case') }} #{{ loop.index }}: {%- elif is_pretest -%} - {{ _('Pretest') }} #{{ test_case_id() }}: + {{ _('Pretest') }} #{{ loop.index }}: {%- else -%} - {{ _('Test case') }} #{{ test_case_id() }}: + {{ _('Test case') }} #{{ loop.index }}: {%- endif -%} {{_('Point')}}: {{ case.points|floatformat }}/{{ case.total|floatformat(0) }}{{_('Point')}}: + {% if not batch.id %} + {{ case.points|floatformat }}/{{ case.total|floatformat(0) }} + {% else %} + - + {% endif %} + {%- if case.status != 'SC' -%} @@ -112,43 +132,41 @@ {% if case.status != 'SC' %}{{_('Memory')}}: {{ case.memory|kbdetailformat }}{% endif %}
+ + {{ _('Output:') }} +
{{ case.output|linebreaksbr }}
- {% if batch.id %}{% endif %} -
+ {% if curr_data != null %} + {{ _('Answer:') }} +
{{ curr_data['answer']|linebreaksbr }}
+ {% endif %} + + {% if case.extended_feedback or case.feedback %} + {{ _('Judge feedback:') }} + {% if case.feedback %} +
{{ case.feedback|linebreaksbr }}
+ {% endif %} + {% if case.extended_feedback %} +
{{ case.extended_feedback|linebreaksbr }}
+ {% endif %} + {% endif %} + + + + {% endif %} + {% endfor %} {% endfor %} + + {% if submission.is_graded %}
{% if submission.result != "AB" %}