@@ -98,6 +98,7 @@ public function runAll(): array
98
98
$ teams = [
99
99
'photos ' => $ this ->checkTeamPhotos (),
100
100
'affiliations ' => $ this ->checkAffiliations (),
101
+ 'categories ' => $ this ->checkCategories (),
101
102
'teamdupenames ' => $ this ->checkTeamDuplicateNames (),
102
103
'selfregistration ' => $ this ->checkSelfRegistration (),
103
104
];
@@ -819,6 +820,34 @@ public function checkAffiliations(): ConfigCheckItem
819
820
);
820
821
}
821
822
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
+
822
851
public function checkTeamDuplicateNames (): ConfigCheckItem
823
852
{
824
853
$ this ->stopwatch ->start (__FUNCTION__ );
0 commit comments