77use App \Entity \QueueTask ;
88use App \Entity \Submission ;
99use App \Entity \Team ;
10+ use App \Entity \TeamCategory ;
1011use App \Entity \User ;
1112use App \Service \DOMJudgeService ;
1213use App \Service \SubmissionService ;
1314use App \Utils \Utils ;
1415use Doctrine \ORM \EntityManagerInterface ;
16+ use Doctrine \ORM \Query \Expr \Join ;
1517use FOS \RestBundle \Controller \AbstractFOSRestController ;
1618use FOS \RestBundle \Controller \Annotations as Rest ;
1719use OpenApi \Attributes as OA ;
@@ -79,9 +81,9 @@ public function prometheusAction(): Response
7981 ->select ('t ' , 'u ' )
8082 ->from (Team::class, 't ' )
8183 ->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 ' )
8485 ->andWhere ('cat.visible = true ' )
86+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
8587 ->getQuery ()
8688 ->getResult ();
8789
@@ -90,9 +92,9 @@ public function prometheusAction(): Response
9092 ->select ('u ' )
9193 ->from (User::class, 'u ' )
9294 ->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 ' )
9596 ->andWhere ('cat.visible = true ' )
97+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
9698 ->getQuery ()
9799 ->getResult ();
98100
@@ -136,11 +138,11 @@ public function prometheusAction(): Response
136138 ->from (Team::class, 't ' )
137139 ->leftJoin ('t.users ' , 'u ' )
138140 ->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 ' )
141142 ->leftJoin ('cat.contests ' , 'cc ' )
142143 ->andWhere ('c.cid = :cid OR cc.cid = :cid ' )
143144 ->andWhere ('cat.visible = true ' )
145+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
144146 ->setParameter ('cid ' , $ contest ->getCid ())
145147 ->getQuery ()
146148 ->getResult ();
@@ -157,11 +159,11 @@ public function prometheusAction(): Response
157159 ->from (User::class, 'u ' )
158160 ->leftJoin ('u.team ' , 't ' )
159161 ->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 ' )
162163 ->leftJoin ('cat.contests ' , 'cc ' )
163164 ->andWhere ('c.cid = :cid OR cc.cid = :cid ' )
164165 ->andWhere ('cat.visible = true ' )
166+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
165167 ->setParameter ('cid ' , $ contest ->getCid ())
166168 ->getQuery ()
167169 ->getResult ();
@@ -231,11 +233,11 @@ public function prometheusAction(): Response
231233 ->join ('b.submission ' , 's ' )
232234 ->join ('s.contest ' , 'c ' )
233235 ->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 ' )
236237 ->andWhere ('b.done = false ' )
237238 ->andWhere ('c.cid = :cid ' )
238239 ->andWhere ('cat.visible = true ' )
240+ ->setParameter ('scoring ' , TeamCategory::TYPE_SCORING )
239241 ->setParameter ('cid ' , $ contest ->getCid ())
240242 ->getQuery ()
241243 ->getResult ();
0 commit comments