@@ -94,6 +94,7 @@ public function runAll(): array
94
94
$ teams = [
95
95
'photos ' => $ this ->checkTeamPhotos (),
96
96
'affiliations ' => $ this ->checkAffiliations (),
97
+ 'categories ' => $ this ->checkCategories (),
97
98
'teamdupenames ' => $ this ->checkTeamDuplicateNames (),
98
99
'selfregistration ' => $ this ->checkSelfRegistration (),
99
100
];
@@ -790,6 +791,34 @@ public function checkAffiliations(): ConfigCheckItem
790
791
);
791
792
}
792
793
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
+
793
822
public function checkTeamDuplicateNames (): ConfigCheckItem
794
823
{
795
824
$ this ->stopwatch ->start (__FUNCTION__ );
0 commit comments