@@ -38,18 +38,16 @@ public function testUpdateFirstToSolve(): void
3838 $ problem = $ entityManager ->getRepository (Problem::class)->findOneBy (['externalid ' => 'hello ' ]);
3939 $ contestProblem = $ problem ->getContestProblems ()->first ();
4040
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 );
4844
45+ // The fixture above sets up that $team1 solved the problem, $team2 didn't.
46+ // So $team1 also solved it first.
4947 static ::assertTrue ($ scoreboard ->solvedFirst ($ team1 , $ contestProblem ));
5048 static ::assertFalse ($ scoreboard ->solvedFirst ($ team2 , $ contestProblem ));
5149
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
5351 $ rejudging = (new Rejudging ())
5452 ->setStarttime (Utils::now ())
5553 ->setReason (__METHOD__ );
@@ -72,9 +70,12 @@ public function testUpdateFirstToSolve(): void
7270 // Now apply the rejudging
7371 $ rejudgingService ->finishRejudging ($ rejudging , RejudgingService::ACTION_APPLY );
7472
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 );
7777
78+ // Now both teams solved the problem, but $team2 solved it first.
7879 static ::assertFalse ($ scoreboard ->solvedFirst ($ team1 , $ contestProblem ));
7980 static ::assertTrue ($ scoreboard ->solvedFirst ($ team2 , $ contestProblem ));
8081 }
0 commit comments