@@ -914,28 +914,15 @@ protected function giveBackJudging(int $judgingId, ?Judgehost $judgehost): void
914914 if ($ judging ) {
915915 $ q = $ this ->em ->createQueryBuilder ()
916916 ->update (JudgingRun::class, 'jr ' )
917- ->join (JudgeTask::class , 'jt ' )
917+ ->join (' jr.judgetask ' , 'jt ' )
918918 ->andWhere ('jr.runresult IS NOT NULL ' )
919919 ->andWhere ('jr.judgingid = :judgingid ' )
920920 ->setParameter ('judgingid ' , $ judgingId );
921921
922922 if ($ judgehost === null ) {
923923 // This is coming from internal errors, reset the whole judging.
924- $ q ->set ('jt.valid ' , 0 );
925- } else {
926- $ q ->andWhere ('jr.run_result IS NOT NULL ' )
927- ->join (JudgeHost::class, 'jh ' )
928- ->set ('jt.judgehostid ' , ':judgehostid ' )
929- ->set ('jt.starttime ' , ':starttime ' )
930- ->setParameter ('judgehostid ' , null )
931- ->setParameter ('starttime ' , null )
932- ->andWhere ('jh.hostname = :judgehost ' )
933- ->setParameter ('judgehost ' , $ judgehost ->getHostname ());
934- }
935-
936- $ q ->getQuery ()->execute ();
924+ $ q ->set ('jt.valid ' , 0 )->getQuery ()->execute ();
937925
938- if ($ judgehost === null ) {
939926 // Invalidate old judging and create a new one - but without judgetasks yet since this was triggered by
940927 // an internal error.
941928 $ judging ->setValid (false );
@@ -947,6 +934,16 @@ protected function giveBackJudging(int $judgingId, ?Judgehost $judgehost): void
947934 ->setOriginalJudging ($ judging );
948935 $ this ->em ->persist ($ newJudging );
949936 $ this ->em ->flush ();
937+ } else {
938+ $ q ->andWhere ('jr.run_result IS NOT NULL ' )
939+ ->join ('jt.judgehost ' , 'jh ' )
940+ ->set ('jt.judgehostid ' , ':judgehostid ' )
941+ ->set ('jt.starttime ' , ':starttime ' )
942+ ->setParameter ('judgehostid ' , null )
943+ ->setParameter ('starttime ' , null )
944+ ->andWhere ('jh.hostname = :judgehost ' )
945+ ->setParameter ('judgehost ' , $ judgehost ->getHostname ())
946+ ->getQuery ()->execute ();
950947 }
951948
952949 $ this ->dj ->auditlog ('judging ' , $ judgingId , 'given back '
0 commit comments