From 65e1b8cabafe2b802cc14d3321c3f78651db86d0 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sat, 15 Mar 2025 11:40:00 +0100 Subject: [PATCH] Disallow negative numbers on the scoreboard. If submissions happen before contest start - realistically these can only happen for jury - they are moved up to the contest start and represented as 0. --- webapp/src/Service/ScoreboardService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webapp/src/Service/ScoreboardService.php b/webapp/src/Service/ScoreboardService.php index 0f345a6bb8..4ed22f3dc2 100644 --- a/webapp/src/Service/ScoreboardService.php +++ b/webapp/src/Service/ScoreboardService.php @@ -328,6 +328,8 @@ public function calculateScoreRow( $runtimeJury = PHP_INT_MAX; $runtimePubl = PHP_INT_MAX; + $contestStartTime = $contest->getStarttime(); + foreach ($submissions as $submission) { /** @var Judging|ExternalJudgement|null $judging */ if ($useExternalJudgements) { @@ -402,6 +404,8 @@ public function calculateScoreRow( // STEP 3: $absSubmitTime = (float)$submission->getSubmittime(); + // Negative numbers don't make sense on the scoreboard, cap them to the contest start. + $absSubmitTime = max($absSubmitTime, $contestStartTime); $submitTime = $contest->getContestTime($absSubmitTime); if ($judging->getResult() == Judging::RESULT_CORRECT) {