44
55use App \Controller \BaseController ;
66use App \Doctrine \DBAL \Types \JudgeTaskType ;
7+ use App \Entity \Executable ;
78use App \Entity \Judgehost ;
89use App \Entity \JudgeTask ;
910use App \Entity \Judging ;
@@ -210,8 +211,19 @@ public function indexAction(Request $request): Response
210211 return strnatcasecmp ($ a ['data ' ]['hostname ' ]['value ' ], $ b ['data ' ]['hostname ' ]['value ' ]);
211212 });
212213
214+ /** @var Executable[] $executables */
215+ $ executables = $ this ->em ->createQueryBuilder ()
216+ ->select ('e as executable, e.execid as execid ' )
217+ ->from (Executable::class, 'e ' )
218+ ->addOrderBy ('e.type ' , 'ASC ' )
219+ ->addOrderBy ('e.execid ' , 'ASC ' )
220+ ->andWhere ('e.type = :type ' )
221+ ->setParameter ('type ' , JudgeTaskType::GENERIC_TASK )
222+ ->getQuery ()->getResult ();
223+
213224 $ data = [
214225 'judgehosts ' => $ judgehosts_table ,
226+ 'executables ' => $ executables ,
215227 'table_fields ' => $ table_fields ,
216228 'all_checked_in_recently ' => $ all_checked_in_recently ,
217229 'refresh ' => [
@@ -278,7 +290,18 @@ public function viewAction(Request $request, int $judgehostid): Response
278290 ->getResult ();
279291 }
280292
293+ /** @var Executable[] $executables */
294+ $ executables = $ this ->em ->createQueryBuilder ()
295+ ->select ('e as executable, e.execid as execid ' )
296+ ->from (Executable::class, 'e ' )
297+ ->addOrderBy ('e.type ' , 'ASC ' )
298+ ->addOrderBy ('e.execid ' , 'ASC ' )
299+ ->andWhere ('e.type = :type ' )
300+ ->setParameter ('type ' , JudgeTaskType::GENERIC_TASK )
301+ ->getQuery ()->getResult ();
302+
281303 $ data = [
304+ 'executables ' => $ executables ,
282305 'judgehost ' => $ judgehost ,
283306 'status ' => $ status ,
284307 'statusIcon ' => $ statusIcon ,
@@ -296,10 +319,10 @@ public function viewAction(Request $request, int $judgehostid): Response
296319 }
297320 }
298321
299- private function helperGenericTask (int $ execid , ?JudgeHost $ judgehost = null ): void {
322+ private function helperGenericTask (string $ execid , ?JudgeHost $ judgehost = null ): void {
300323 $ executable = $ this ->em ->getRepository (Executable::class)->findOneBy (['execid ' => $ execid ]);
301324 if (!$ executable ) {
302- throw new NotFoundHttpException (sprintf ('Executable with ID %d not found ' , $ execid ));
325+ throw new NotFoundHttpException (sprintf ('Executable with ID %s not found ' , $ execid ));
303326 }
304327
305328 $ executable = $ executable ->getImmutableExecutable ();
@@ -329,7 +352,7 @@ private function helperGenericTask(int $execid, ?JudgeHost $judgehost = null): v
329352
330353 #[IsGranted('ROLE_ADMIN ' )]
331354 #[Route(path: '/{judgehostid}/request-generic-task/{execid} ' , name: 'jury_request_judgehost_generic ' )]
332- public function requestGenericTaskJudgehost (Request $ request , int $ judgehostid , int $ execid ): RedirectResponse
355+ public function requestGenericTaskJudgehost (Request $ request , int $ judgehostid , string $ execid ): RedirectResponse
333356 {
334357 $ judgehost = $ this ->em ->getRepository (Judgehost::class)->find ($ judgehostid );
335358 if (!$ judgehost ) {
@@ -346,7 +369,7 @@ public function requestGenericTaskJudgehost(Request $request, int $judgehostid,
346369 // TODO: Does the ordering matter in the file.
347370 #[IsGranted('ROLE_ADMIN ' )]
348371 #[Route(path: '/request-generic-task/{execid} ' , name: 'jury_request_generic ' )]
349- public function requestGenericTask (Request $ request , int $ execid ): RedirectResponse
372+ public function requestGenericTask (Request $ request , string $ execid ): RedirectResponse
350373 {
351374 $ this ->helperGenericTask ($ execid );
352375 return $ this ->redirectToRoute ('jury_judgehost ' , [
0 commit comments