Skip to content

Commit 7dca1b8

Browse files
authored
Merge branch 'main' into disallownegs
2 parents 754837c + 94940dd commit 7dca1b8

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

webapp/src/DataFixtures/Test/RejudgingFirstToSolveFixture.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ public function load(ObjectManager $manager): void
2222

2323
$manager->persist($team2);
2424

25+
$contest = $manager->getRepository(Contest::class)->findOneBy(['shortname' => 'demo']);
26+
// Two submissions, one for each team, the incorrect one before the correct one.
27+
// Later, in the test, we will flip the 'wrong-answer' to correct in
28+
// order to produce a new first to solve.
2529
$submissionData = [
26-
// team, submittime, result]
27-
[$team1, '2021-01-01 12:34:56', 'correct'],
28-
[$team2, '2021-01-01 12:33:56', 'wrong-answer'],
30+
// team, submittime, result]
31+
[$team2, $contest->getStarttime() + 300, 'wrong-answer'],
32+
[$team1, $contest->getStarttime() + 400, 'correct'],
2933
];
3034

31-
$contest = $manager->getRepository(Contest::class)->findOneBy(['shortname' => 'demo']);
3235
$language = $manager->getRepository(Language::class)->find('cpp');
3336
$problem = $contest->getProblems()->filter(fn(ContestProblem $problem) => $problem->getShortname() === 'A')->first();
3437

@@ -39,11 +42,11 @@ public function load(ObjectManager $manager): void
3942
->setContestProblem($problem)
4043
->setLanguage($language)
4144
->setValid(true)
42-
->setSubmittime(Utils::toEpochFloat($submissionItem[1]));
45+
->setSubmittime($submissionItem[1]);
4346
$judging = (new Judging())
4447
->setContest($contest)
45-
->setStarttime(Utils::toEpochFloat($submissionItem[1]))
46-
->setEndtime(Utils::toEpochFloat($submissionItem[1]) + 5)
48+
->setStarttime($submissionItem[1])
49+
->setEndtime($submissionItem[1] + 5)
4750
->setValid(true)
4851
->setResult($submissionItem[2]);
4952
$judging->setSubmission($submission);

webapp/src/Service/ScoreboardService.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ public function updateRankCache(Contest $contest, Team $team): void
558558
$scoreIsInSeconds = (bool)$this->config->get('score_in_seconds');
559559

560560
// Now fetch the ScoreCache entries.
561-
/** @var ScoreCache[] $scoreCacheRows */
562-
$scoreCacheRows = $this->em->createQueryBuilder()
561+
/** @var ScoreCache[] $scoreCacheCells */
562+
$scoreCacheCells = $this->em->createQueryBuilder()
563563
->from(ScoreCache::class, 's')
564564
->select('s')
565565
->andWhere('s.contest = :contest')
@@ -569,21 +569,21 @@ public function updateRankCache(Contest $contest, Team $team): void
569569
->getQuery()
570570
->getResult();
571571

572-
// Process all score cache rows.
573-
foreach ($scoreCacheRows as $scoreCache) {
572+
// Process all score cache cells.
573+
foreach ($scoreCacheCells as $scoreCacheCell) {
574574
foreach ($variants as $variant => $isRestricted) {
575-
$probId = $scoreCache->getProblem()->getProbid();
576-
if (isset($contestProblems[$probId]) && $scoreCache->getIsCorrect($isRestricted)) {
577-
$penalty = Utils::calcPenaltyTime($scoreCache->getIsCorrect($isRestricted),
578-
$scoreCache->getSubmissions($isRestricted),
575+
$probId = $scoreCacheCell->getProblem()->getProbid();
576+
if (isset($contestProblems[$probId]) && $scoreCacheCell->getIsCorrect($isRestricted)) {
577+
$penalty = Utils::calcPenaltyTime($scoreCacheCell->getIsCorrect($isRestricted),
578+
$scoreCacheCell->getSubmissions($isRestricted),
579579
$penaltyTime, $scoreIsInSeconds);
580580

581581
$numPoints[$variant] += $contestProblems[$probId]->getPoints();
582582
$totalTime[$variant] += Utils::scoretime(
583-
(float)$scoreCache->getSolveTime($isRestricted),
583+
(float)$scoreCacheCell->getSolveTime($isRestricted),
584584
$scoreIsInSeconds
585585
) + $penalty;
586-
$totalRuntime[$variant] += $scoreCache->getRuntime($isRestricted);
586+
$totalRuntime[$variant] += $scoreCacheCell->getRuntime($isRestricted);
587587
}
588588
}
589589
}

webapp/templates/jury/analysis/problem.html.twig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
.card {
1717
height: 100%;
1818
}
19-
20-
/* Don't show x-axis ticks/ticklines for max runtimes chart. */
21-
#maxruntime .nv-x.nv-axis .tick {
22-
display: none;
23-
}
2419
</style>
2520
{% endblock %}
2621

@@ -133,7 +128,10 @@ $(function(){
133128
chart.yAxis
134129
.tickFormat(d3.format('.3f'))
135130
.axisLabel('Runtime(in s)');
136-
chart.xAxis.axisLabel("Judgings");
131+
chart.xAxis
132+
.ticks(0)
133+
.tickValues([])
134+
.axisLabel("Judgings");
137135
d3.select('#maxruntime svg')
138136
.datum(run_max_times)
139137
.call(chart);

0 commit comments

Comments
 (0)