Skip to content

Commit

Permalink
Balloon list: only add 'first in contest' if there is no earlier unju…
Browse files Browse the repository at this point in the history
…dged submission.

The 'first for problem' is already working correctly as it re-uses the
corresponding scoreboard data.

Fixes DOMjudge#2810.
  • Loading branch information
meisterT committed Nov 21, 2024
1 parent 7c890e8 commit 15aeae7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions webapp/src/Service/BalloonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,26 @@ public function collectBalloonTable(Contest $contest, bool $todo = false): array
}
// Keep overwriting this - in the end it'll
// contain the ID of the first balloon in this contest.
$submittime = $balloonsData[0]->getSubmission()->getSubmittime();
$AWARD_BALLOONS['contest'] = $balloonsData[0]->getBalloonId();
}
$countBefore = $em->createQueryBuilder()
->from(Judging::class, 'j')
->leftJoin('j.submission', 's')
->select('COUNT(s.submitid)')
->where('s.contest = :cid')
->andWhere('s.submittime < :submittime')
->andWhere('s.valid = 1')
->andWhere('j.valid = 1')
->andWhere('j.result IS NULL')
->setParameter('cid', $contest->getCid())
->setParameter('submittime', $submittime)
->getQuery()->getSingleScalarResult();
if ($countBefore > 0) {
// We don't have complete information about 'first in contest' yet as there are unjudged submissions that
// could influence the result.
$AWARD_BALLOONS['contest'] = -1;
}

// Loop again to construct table.
$balloons_table = [];
Expand Down

0 comments on commit 15aeae7

Please sign in to comment.