diff --git a/etc/db-config.yaml b/etc/db-config.yaml index a3e1ef8f7d..aa9df87a04 100644 --- a/etc/db-config.yaml +++ b/etc/db-config.yaml @@ -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 diff --git a/webapp/src/Controller/Team/MiscController.php b/webapp/src/Controller/Team/MiscController.php index 7b1e03c1d8..8c6f842d17 100644 --- a/webapp/src/Controller/Team/MiscController.php +++ b/webapp/src/Controller/Team/MiscController.php @@ -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()) { diff --git a/webapp/src/Controller/Team/SubmissionController.php b/webapp/src/Controller/Team/SubmissionController.php index 29d3ceae8c..f9e17f335d 100644 --- a/webapp/src/Controller/Team/SubmissionController.php +++ b/webapp/src/Controller/Team/SubmissionController.php @@ -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') @@ -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'; diff --git a/webapp/templates/team/partials/submission.html.twig b/webapp/templates/team/partials/submission.html.twig index 1537f604f7..1a630e5c28 100644 --- a/webapp/templates/team/partials/submission.html.twig +++ b/webapp/templates/team/partials/submission.html.twig @@ -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) %}
Submission not found for this team or not judged yet.
{% else %}
diff --git a/webapp/templates/team/partials/submission_list.html.twig b/webapp/templates/team/partials/submission_list.html.twig index 515b02ad69..77b96645b1 100644 --- a/webapp/templates/team/partials/submission_list.html.twig +++ b/webapp/templates/team/partials/submission_list.html.twig @@ -22,7 +22,7 @@ {%- 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 %} @@ -52,13 +52,19 @@ {%- 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 %}