Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balloon list: only add 'first in contest' if there is no earlier unju… #2812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading