Skip to content

Commit 441070d

Browse files
committed
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.
1 parent 13902e7 commit 441070d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webapp/src/Service/ScoreboardService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ public function calculateScoreRow(
328328
$runtimeJury = PHP_INT_MAX;
329329
$runtimePubl = PHP_INT_MAX;
330330

331+
$contestStartTime = $contest->getStarttime();
332+
331333
foreach ($submissions as $submission) {
332334
/** @var Judging|ExternalJudgement|null $judging */
333335
if ($useExternalJudgements) {
@@ -402,6 +404,8 @@ public function calculateScoreRow(
402404

403405
// STEP 3:
404406
$absSubmitTime = (float)$submission->getSubmittime();
407+
// Negative numbers don't make sense on the scoreboard, cap them to the contest start.
408+
$absSubmitTime = max($absSubmitTime, $contestStartTime);
405409
$submitTime = $contest->getContestTime($absSubmitTime);
406410

407411
if ($judging->getResult() == Judging::RESULT_CORRECT) {

0 commit comments

Comments
 (0)