Fix ioi16

This commit is contained in:
cuom1999 2022-12-28 22:50:26 -06:00
parent 02e2539606
commit 5f7199669c
4 changed files with 55 additions and 4 deletions

View file

@ -226,9 +226,22 @@ class SubmissionStatus(SubmissionDetailBase):
return True
return False
def get_frozen_subtasks(self):
if self.request.user.is_superuser:
return set()
submission = self.object
contest = submission.contest_object
if contest and contest.format_name == "ioi16":
contest_problem = contest.contest_problems.get(problem=submission.problem)
return contest.format.get_frozen_subtasks().get(
str(contest_problem.id), set()
)
return set()
def get_context_data(self, **kwargs):
context = super(SubmissionStatus, self).get_context_data(**kwargs)
submission = self.object
context["last_msg"] = event.last()
context["batches"] = group_test_cases(submission.test_cases.all())
context["time_limit"] = submission.problem.time_limit
@ -237,6 +250,7 @@ class SubmissionStatus(SubmissionDetailBase):
context["highlighted_source"] = highlight_code(
submission.source.source, submission.language.pygments, linenos=False
)
context["frozen_subtasks"] = self.get_frozen_subtasks()
contest = submission.contest_or_none
prefix_length = 0
@ -869,10 +883,10 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
submission = Submission.objects.get(id=sub_id)
if (
subtask in frozen_subtasks.get(str(problem_id), set())
and not self.include_frozen
and not self.request.user.is_superuser
):
best_subtasks[subtask] = {
"submission": submission,
"submission": None,
"contest_time": nice_repr(
self.contest_time(submission), "noday"
),

View file

@ -1,4 +1,21 @@
{% set can_view = submission_layout(submission, profile_id, request.user, editable_problem_ids, completed_problem_ids) %}
{% set hidden = submission.contest_object and submission.contest_object.format_name == "ioi16" and not request.user.is_superuser %}
{% if hidden %}
<div class="sub-result TLE">
<div class="score">
{%- if submission.is_graded -%}
??? / {{ submission.case_total|floatformat(0) }}
{%- else -%}
<i class="fa fa-spinner fa-pulse"></i>
{%- endif -%}
</div>
<div class="state">
<span title="?" class="status">?</span> |
<span class="language">{{ submission.language.short_display_name }}</span>
</div>
</div>
{% else %}
<div class="sub-result {{ submission.result_class }}">
<div class="score">
{%- if submission.is_graded -%}
@ -17,6 +34,7 @@
<span class="language">{{ submission.language.short_display_name }}</span>
</div>
</div>
{% endif %}
<div class="sub-info{% if submission.status == 'G' %} sub-info-grading{% endif %}">
{% if show_problem %}
<div class="name"><a href="{{ url('problem_detail', submission.problem.code) }}">{{ problem_name }}</a></div>
@ -33,7 +51,7 @@
</div>
</div>
{% if submission.status == 'G' %}
{% if submission.status == 'G' and not hidden %}
<div class="sub-testcase">
{%- if submission.current_testcase > 0 -%}
{{ _('Point %(point)s / Case #%(case)s', point=submission.points|floatformat(1), case=submission.current_testcase) }}
@ -61,6 +79,12 @@
</div></div>
{% endif %}
{% if hidden %}
<div class="sub-usage">
<div class="time">---</div>
<div class="memory">---</div>
</div>
{% else %}
<div class="sub-usage">
{% if submission.status in ('QU', 'P', 'G', 'CE', 'IE', 'AB') %}
<div class="time">---</div>
@ -77,3 +101,4 @@
<div class="memory">{{ (submission.memory_bytes|filesizeformat(True)).replace('i', '') }}</div>
{% endif %}
</div>
{% endif %}

View file

@ -26,6 +26,7 @@
{% endif %}
{% for batch in batches %}
{% if batch.id not in frozen_subtasks %}
<div style="margin-top: 0.5em;">
{% if batch.id %}
<b>{{ _('Batch ') }}#{{ batch.id }} ({{batch.points|floatformat}} / {{batch.total|floatformat}}): </b>
@ -40,11 +41,18 @@
</span>
{% endfor %}
</div>
{% else %}
<div style="margin-top: 0.5em;">
{% if batch.id %}
<b>{{ _('Batch ') }}#{{ batch.id }} (??? / {{batch.total|floatformat}})</b>
{% endif %}
</div>
{% endif %}
{% endfor %}
<br>
<table class="testcases-table">
{% if submission.is_graded and submission.result != 'AB' %}
{% if submission.is_graded and submission.result != 'AB' and not frozen_subtasks %}
<thead>
<tr id="overall-row" class="case-row overall-result-{{submission.result}}">
<td><span class="col-title">{{_('Overall: ')}}</span>
@ -82,6 +90,7 @@
<tbody>
{% for batch in batches %}
{% if batch.id not in frozen_subtasks %}
{% if batch.id %}
{% set batch_AC = (batch.points == batch.total) %}
<tr class="case-row background-{{'d6e8f7' if batch.points == batch.total else 'bisque'}}">
@ -174,6 +183,7 @@
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</tbody></table>

View file

@ -16,12 +16,14 @@
<td>
({{ cur_subtask.contest_time }})
</td>
{% if cur_subtask.submission %}
{% set can_view = submission_layout(cur_subtask.submission, profile_id, request.user, editable_problem_ids, completed_problem_ids) %}
{% if can_view %}
<td>
<a href="{{url('submission_status', cur_subtask.submission.id)}}">{{ cur_subtask.submission.id }}</a>
</td>
{% endif %}
{% endif %}
</tr>
{% endfor %}
<tr>