Skip to content

Commit

Permalink
Add feature to display result of too-late submissions
Browse files Browse the repository at this point in the history
For team interface, show the specific judge result of
too-late submissions, meanwhile add a global configuration
option to enable/disable this feature.
  • Loading branch information
2018hahazhufeng committed Jul 23, 2023
1 parent 9f780cb commit 6fa95b5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
5 changes: 5 additions & 0 deletions etc/db-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@
default_value: false
public: true
description: Should teams be able to view a diff of their and the reference output on sample testcases?
- name: show_too_late_result
type: bool
default_value: false
public: true
description: Show results of TOO-LATE submissions in team interface?
- name: show_balloons_postfreeze
type: bool
default_value: false
Expand Down
1 change: 1 addition & 0 deletions webapp/src/Controller/Team/MiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function homeAction(Request $request): Response
$data['clarificationRequests'] = $clarificationRequests;
$data['categories'] = $this->config->get('clar_categories');
$data['allowDownload'] = (bool)$this->config->get('allow_team_submission_download');
$data['showTooLateResult'] = $this->config->get('show_too_late_result');
}

if ($request->isXmlHttpRequest()) {
Expand Down
14 changes: 8 additions & 6 deletions webapp/src/Controller/Team/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ public function createAction(Request $request, ?Problem $problem = null): Respon
public function viewAction(Request $request, int $submitId): Response
{
$verificationRequired = (bool)$this->config->get('verification_required');
$showCompile = $this->config->get('show_compile');
$showSampleOutput = $this->config->get('show_sample_output');
$allowDownload = (bool)$this->config->get('allow_team_submission_download');
$user = $this->dj->getUser();
$team = $user->getTeam();
$contest = $this->dj->getCurrentContest($team->getTeamid());
$showCompile = $this->config->get('show_compile');
$showSampleOutput = $this->config->get('show_sample_output');
$allowDownload = (bool)$this->config->get('allow_team_submission_download');
$showTooLateResult = $this->config->get('show_too_late_result');
$user = $this->dj->getUser();
$team = $user->getTeam();
$contest = $this->dj->getCurrentContest($team->getTeamid());
/** @var Judging|null $judging */
$judging = $this->em->createQueryBuilder()
->from(Judging::class, 'j')
Expand Down Expand Up @@ -192,6 +193,7 @@ public function viewAction(Request $request, int $submitId): Response
'allowDownload' => $allowDownload,
'showSampleOutput' => $showSampleOutput,
'runs' => $runs,
'showTooLateResult' => $showTooLateResult,
];
if ($actuallyShowCompile) {
$data['size'] = 'xl';
Expand Down
2 changes: 1 addition & 1 deletion webapp/templates/team/partials/submission.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if judging is empty or judging.submission.submittime >= current_team_contest.endtime or (verificationRequired and not judging.verified) %}
{% if judging is empty or (not showTooLateResult and judging.submission.submittime >= current_team_contest.endtime) or (verificationRequired and not judging.verified) %}
<div class="alert alert-danger">Submission not found for this team or not judged yet.</div>
{% else %}
<div class="container">
Expand Down
22 changes: 14 additions & 8 deletions webapp/templates/team/partials/submission_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tbody>
{%- for submission in submissions %}
{% set link = null %}
{% if submission.submittime < current_team_contest.endtime and submission.result and submission.judgings.first is not empty and submission.judgings.first.result is not empty and (not verificationRequired or submission.judgings.first.verified) %}
{% if (submission.submittime < current_team_contest.endtime or showTooLateResult) and submission.result and submission.judgings.first is not empty and submission.judgings.first.result is not empty and (not verificationRequired or submission.judgings.first.verified) %}
{% set link = path('team_submission', {submitId: submission.submitid}) %}
{% endif %}

Expand Down Expand Up @@ -52,13 +52,19 @@
<td>
<a data-ajax-modal data-ajax-modal-after="markSeen" {% if link %}href="{{ link }}"{% endif %}>
{%- if submission.submittime > submission.contest.endtime %}
{{ 'too-late' | printResult }}
{%- elseif submission.judgings.first is empty or submission.judgings.first.result is empty %}
{{- '' | printResult -}}
{%- elseif verificationRequired and not submission.judgings.first.verified %}
{{- '' | printResult -}}
{%- else %}
{{- submission.judgings.first.result | printResult -}}
{{ 'too-late' | printResult }}
{%- endif %}
{%- if submission.submittime <= submission.contest.endtime or showTooLateResult %}
{%- if submission.submittime > submission.contest.endtime %}
/
{% endif %}
{%- if submission.judgings.first is empty or submission.judgings.first.result is empty %}
{{- '' | printResult -}}
{%- elseif verificationRequired and not submission.judgings.first.verified %}
{{- '' | printResult -}}
{%- else %}
{{- submission.judgings.first.result | printResult -}}
{%- endif %}
{%- endif %}
</a>
</td>
Expand Down

0 comments on commit 6fa95b5

Please sign in to comment.