@@ -38,18 +38,16 @@ public function testUpdateFirstToSolve(): void
38
38
$ problem = $ entityManager ->getRepository (Problem::class)->findOneBy (['externalid ' => 'hello ' ]);
39
39
$ contestProblem = $ problem ->getContestProblems ()->first ();
40
40
41
- // Get the initial scoreboard. team 1 should have the FTS for the problem, team 2 shouldn't
42
- foreach ([$ team1 , $ team2 ] as $ team ) {
43
- $ scoreboardService ->calculateScoreRow ($ contest , $ team , $ problem );
44
- $ scoreboardService ->calculateTeamRank ($ contest , $ team );
45
- }
46
-
47
- $ scoreboard = $ scoreboardService ->getScoreboard ($ contest , true );
41
+ // Get the initial scoreboard.
42
+ $ scoreboardService ->refreshCache ($ contest );
43
+ $ scoreboard = $ scoreboardService ->getScoreboard ($ contest , jury: true );
48
44
45
+ // The fixture above sets up that $team1 solved the problem, $team2 didn't.
46
+ // So $team1 also solved it first.
49
47
static ::assertTrue ($ scoreboard ->solvedFirst ($ team1 , $ contestProblem ));
50
48
static ::assertFalse ($ scoreboard ->solvedFirst ($ team2 , $ contestProblem ));
51
49
52
- // Now create a rejudging: it will apply a new judging for the submission of $team2 that is correct
50
+ // Now create a rejudging: it will apply a new fake judging for the submission of $team2 that is correct
53
51
$ rejudging = (new Rejudging ())
54
52
->setStarttime (Utils::now ())
55
53
->setReason (__METHOD__ );
@@ -72,9 +70,12 @@ public function testUpdateFirstToSolve(): void
72
70
// Now apply the rejudging
73
71
$ rejudgingService ->finishRejudging ($ rejudging , RejudgingService::ACTION_APPLY );
74
72
75
- // Finally, get the scoreboard again and test if the first to solve changed
76
- $ scoreboard = $ scoreboardService ->getScoreboard ($ contest , true );
73
+ // Retrieve the scoreboard again.
74
+ // Note that there is no manual scoreboard refresh necessary here as the rejudging service does all
75
+ // necessary updates.
76
+ $ scoreboard = $ scoreboardService ->getScoreboard ($ contest , jury: true );
77
77
78
+ // Now both teams solved the problem, but $team2 solved it first.
78
79
static ::assertFalse ($ scoreboard ->solvedFirst ($ team1 , $ contestProblem ));
79
80
static ::assertTrue ($ scoreboard ->solvedFirst ($ team2 , $ contestProblem ));
80
81
}
0 commit comments