@@ -94,6 +94,7 @@ public function runAll(): array
9494 $ teams = [
9595 'photos ' => $ this ->checkTeamPhotos (),
9696 'affiliations ' => $ this ->checkAffiliations (),
97+ 'categories ' => $ this ->checkCategories (),
9798 'teamdupenames ' => $ this ->checkTeamDuplicateNames (),
9899 'selfregistration ' => $ this ->checkSelfRegistration (),
99100 ];
@@ -790,6 +791,34 @@ public function checkAffiliations(): ConfigCheckItem
790791 );
791792 }
792793
794+ public function checkCategories (): ConfigCheckItem
795+ {
796+ $ this ->stopwatch ->start (__FUNCTION__ );
797+ /** @var Team[] $teams */
798+ $ teams = $ this ->em ->getRepository (Team::class)
799+ ->createQueryBuilder ('t ' )
800+ ->innerJoin ('t.categories ' , 'c ' )
801+ ->select ('t, c ' );
802+
803+ $ desc = '' ;
804+ $ result = 'O ' ;
805+ foreach ($ teams as $ team ) {
806+ if (!$ team ->getScoringCategory ()) {
807+ $ result = 'W ' ;
808+ $ desc .= sprintf (" - Team `t%d` (%s) does not belong to any scoring category \n" , $ team ->getTeamid (), $ team ->getName ());
809+ }
810+ }
811+
812+ $ desc = $ desc ?: 'Everything OK ' ;
813+
814+ $ this ->stopwatch ->stop (__FUNCTION__ );
815+ return new ConfigCheckItem (
816+ caption: 'Team categories ' ,
817+ result: $ result ,
818+ desc: $ desc
819+ );
820+ }
821+
793822 public function checkTeamDuplicateNames (): ConfigCheckItem
794823 {
795824 $ this ->stopwatch ->start (__FUNCTION__ );
0 commit comments