@@ -98,6 +98,7 @@ public function runAll(): array
9898 $ teams = [
9999 'photos ' => $ this ->checkTeamPhotos (),
100100 'affiliations ' => $ this ->checkAffiliations (),
101+ 'categories ' => $ this ->checkCategories (),
101102 'teamdupenames ' => $ this ->checkTeamDuplicateNames (),
102103 'selfregistration ' => $ this ->checkSelfRegistration (),
103104 ];
@@ -819,6 +820,34 @@ public function checkAffiliations(): ConfigCheckItem
819820 );
820821 }
821822
823+ public function checkCategories (): ConfigCheckItem
824+ {
825+ $ this ->stopwatch ->start (__FUNCTION__ );
826+ /** @var Team[] $teams */
827+ $ teams = $ this ->em ->getRepository (Team::class)
828+ ->createQueryBuilder ('t ' )
829+ ->innerJoin ('t.categories ' , 'c ' )
830+ ->select ('t, c ' );
831+
832+ $ desc = '' ;
833+ $ result = 'O ' ;
834+ foreach ($ teams as $ team ) {
835+ if (!$ team ->getScoringCategory ()) {
836+ $ result = 'W ' ;
837+ $ desc .= sprintf (" - Team `t%d` (%s) does not belong to any scoring category \n" , $ team ->getTeamid (), $ team ->getName ());
838+ }
839+ }
840+
841+ $ desc = $ desc ?: 'Everything OK ' ;
842+
843+ $ this ->stopwatch ->stop (__FUNCTION__ );
844+ return new ConfigCheckItem (
845+ caption: 'Team categories ' ,
846+ result: $ result ,
847+ desc: $ desc
848+ );
849+ }
850+
822851 public function checkTeamDuplicateNames (): ConfigCheckItem
823852 {
824853 $ this ->stopwatch ->start (__FUNCTION__ );
0 commit comments