@@ -1649,36 +1649,13 @@ private function actuallyCreateJudgetasks(int $priority, Judging $judging, int $
16491649
16501650 $ this ->em ->getConnection ()->executeQuery ($ judgetaskInsertQuery , $ judgetaskInsertParamsWithoutColon );
16511651
1652- // Step 3: Fetch the judgetasks ID's per testcase.
1653- $ judgetaskData = $ this ->em ->getConnection ()->executeQuery (
1654- 'SELECT judgetaskid, testcase_id FROM judgetask WHERE jobid = :jobid ORDER BY judgetaskid ' ,
1655- ['jobid ' => $ judging ->getJudgingid ()]
1656- )->fetchAllAssociative ();
1657-
1658- // Step 4: Create and insert the corresponding judging runs.
1659- $ judgingRunInsertParams = [':judgingid ' => $ judging ->getJudgingid ()];
1660- $ judgingRunInsertParts = [];
1661- foreach ($ judgetaskData as $ judgetaskItem ) {
1662- $ judgingRunInsertParts [] = sprintf (
1663- '(:judgingid, :testcaseid%d, :judgetaskid%d) ' ,
1664- $ judgetaskItem ['judgetaskid ' ],
1665- $ judgetaskItem ['judgetaskid ' ]
1666- );
1667- $ judgingRunInsertParams [':testcaseid ' . $ judgetaskItem ['judgetaskid ' ]] = $ judgetaskItem ['testcase_id ' ];
1668- $ judgingRunInsertParams [':judgetaskid ' . $ judgetaskItem ['judgetaskid ' ]] = $ judgetaskItem ['judgetaskid ' ];
1669- }
1670- $ judgingRunInsertQuery = sprintf (
1671- 'INSERT INTO judging_run (judgingid, testcaseid, judgetaskid) VALUES %s ' ,
1672- implode (', ' , $ judgingRunInsertParts )
1652+ // Step 3: Insert the corresponding judging runs.
1653+ $ this ->em ->getConnection ()->executeQuery (
1654+ 'INSERT INTO judging_run (judgingid, judgetaskid, testcaseid)
1655+ SELECT :judgingid, judgetaskid, testcase_id FROM judgetask
1656+ WHERE jobid = :judgingid ORDER BY judgetaskid ' ,
1657+ ['judgingid ' => $ judging ->getJudgingid ()]
16731658 );
1674-
1675- $ judgingRunInsertParamsWithoutColon = [];
1676- foreach ($ judgingRunInsertParams as $ key => $ param ) {
1677- $ key = str_replace (': ' , '' , $ key );
1678- $ judgingRunInsertParamsWithoutColon [$ key ] = $ param ;
1679- }
1680-
1681- $ this ->em ->getConnection ()->executeQuery ($ judgingRunInsertQuery , $ judgingRunInsertParamsWithoutColon );
16821659 }
16831660
16841661 public function shadowMode (): bool
0 commit comments