7
7
use App \Entity \QueueTask ;
8
8
use App \Entity \Submission ;
9
9
use App \Entity \Team ;
10
+ use App \Entity \TeamCategory ;
10
11
use App \Entity \User ;
11
12
use App \Service \DOMJudgeService ;
12
13
use App \Service \SubmissionService ;
13
14
use App \Utils \Utils ;
14
15
use Doctrine \ORM \EntityManagerInterface ;
16
+ use Doctrine \ORM \Query \Expr \Join ;
15
17
use FOS \RestBundle \Controller \AbstractFOSRestController ;
16
18
use FOS \RestBundle \Controller \Annotations as Rest ;
17
19
use OpenApi \Attributes as OA ;
@@ -79,9 +81,9 @@ public function prometheusAction(): Response
79
81
->select ('t ' , 'u ' )
80
82
->from (Team::class, 't ' )
81
83
->leftJoin ('t.users ' , 'u ' )
82
- // TODO: category type
83
- ->join ('t.categories ' , 'cat ' )
84
+ ->join ('t.categories ' , 'cat ' , Join::WITH , 'BIT_AND(cat.types, :scoring) = :scoring ' )
84
85
->andWhere ('cat.visible = true ' )
86
+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
85
87
->getQuery ()
86
88
->getResult ();
87
89
@@ -90,9 +92,9 @@ public function prometheusAction(): Response
90
92
->select ('u ' )
91
93
->from (User::class, 'u ' )
92
94
->leftJoin ('u.team ' , 't ' )
93
- // TODO: category type
94
- ->join ('t.categories ' , 'cat ' )
95
+ ->join ('t.categories ' , 'cat ' , Join::WITH , 'BIT_AND(cat.types, :scoring) = :scoring ' )
95
96
->andWhere ('cat.visible = true ' )
97
+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
96
98
->getQuery ()
97
99
->getResult ();
98
100
@@ -136,11 +138,11 @@ public function prometheusAction(): Response
136
138
->from (Team::class, 't ' )
137
139
->leftJoin ('t.users ' , 'u ' )
138
140
->leftJoin ('t.contests ' , 'c ' )
139
- // TODO: category type
140
- ->join ('t.categories ' , 'cat ' )
141
+ ->join ('t.categories ' , 'cat ' , Join::WITH , 'BIT_AND(cat.types, :scoring) = :scoring ' )
141
142
->leftJoin ('cat.contests ' , 'cc ' )
142
143
->andWhere ('c.cid = :cid OR cc.cid = :cid ' )
143
144
->andWhere ('cat.visible = true ' )
145
+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
144
146
->setParameter ('cid ' , $ contest ->getCid ())
145
147
->getQuery ()
146
148
->getResult ();
@@ -157,11 +159,11 @@ public function prometheusAction(): Response
157
159
->from (User::class, 'u ' )
158
160
->leftJoin ('u.team ' , 't ' )
159
161
->leftJoin ('t.contests ' , 'c ' )
160
- // TODO: category type
161
- ->join ('t.categories ' , 'cat ' )
162
+ ->join ('t.categories ' , 'cat ' , Join::WITH , 'BIT_AND(cat.types, :scoring) = :scoring ' )
162
163
->leftJoin ('cat.contests ' , 'cc ' )
163
164
->andWhere ('c.cid = :cid OR cc.cid = :cid ' )
164
165
->andWhere ('cat.visible = true ' )
166
+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
165
167
->setParameter ('cid ' , $ contest ->getCid ())
166
168
->getQuery ()
167
169
->getResult ();
@@ -231,11 +233,11 @@ public function prometheusAction(): Response
231
233
->join ('b.submission ' , 's ' )
232
234
->join ('s.contest ' , 'c ' )
233
235
->join ('s.team ' , 't ' )
234
- // TODO: category type
235
- ->join ('t.categories ' , 'cat ' )
236
+ ->join ('t.categories ' , 'cat ' , Join::WITH , 'BIT_AND(cat.types, :scoring) = :scoring ' )
236
237
->andWhere ('b.done = false ' )
237
238
->andWhere ('c.cid = :cid ' )
238
239
->andWhere ('cat.visible = true ' )
240
+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
239
241
->setParameter ('cid ' , $ contest ->getCid ())
240
242
->getQuery ()
241
243
->getResult ();
0 commit comments