@@ -853,32 +853,23 @@ public function internalErrorAction(Request $request): ?int
853853
854854 if  ($ field_namenull ) {
855855 // Disable any outstanding judgetasks with the same script that have not been claimed yet. 
856-  $ this em ->wrapInTransaction (function  (EntityManager $ emuse  ($ field_name$ disabled_id$ error
857-  $ judgingids$ emgetConnection ()->executeQuery (
858-  'SELECT DISTINCT jobid ' 
859-  . ' FROM judgetask ' 
860-  . ' WHERE  '  . $ field_name' = :id ' 
861-  . ' AND judgehostid IS NULL ' 
862-  . ' AND valid = 1 ' ,
863-  [
864-  'id '  => $ disabled_id
865-  ]
866-  )->fetchFirstColumn ();
867-  $ judgings$ emgetRepository (Judging::class)->findBy (['judgingid '  => $ judgingids
868-  foreach  ($ judgingsas  $ judging
869-  /** @var Judging $judging */ 
870-  $ judgingsetInternalError ($ error
871-  }
872-  $ emflush ();
873-  $ emgetConnection ()->executeStatement (
874-  'UPDATE judgetask SET valid=0 ' 
875-  . ' WHERE  '  . $ field_name' = :id ' 
876-  . ' AND judgehostid IS NULL ' ,
877-  [
878-  'id '  => $ disabled_id
879-  ]
880-  );
881-  });
856+  $ rows$ this em ->createQueryBuilder ()
857+  ->update (Judging::class, 'j ' )
858+  ->leftJoin (JudgeTask::class, 'jt ' , Join::WITH , 'jt.jobid = j.judgingid ' )
859+  ->set ('j.internal_error ' , $ error
860+  ->set ('jt.valid ' , 0 )
861+  ->where ('jt. '  . $ field_name' = :id ' )
862+  ->andWhere ('j.internal_error IS NULL ' )
863+  ->andWhere ('jt.judgehost_id IS NULL ' )
864+  ->andWhere ('jt.valid = 1 ' )
865+  ->setParameter ('id ' , $ disabled_id
866+  ->distinct ()
867+  ->getQuery ()
868+  ->getArrayResult ();
869+ 870+  if  ($ rows0 ) {
871+  // TODO, handle this case. Nothing was updated. 
872+  }
882873 }
883874
884875 $ this dj ->setInternalError ($ disabled$ contestfalse );
0 commit comments