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