From fbaca32615c17615c1e6fc7a11fee249f0acbe78 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Mon, 27 Mar 2023 00:14:38 +0200 Subject: [PATCH] Teams can't select a same problem for the two days Signed-off-by: Emmy D'Anello --- draw/consumers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/draw/consumers.py b/draw/consumers.py index 9ac7b5c..0e6d10c 100644 --- a/draw/consumers.py +++ b/draw/consumers.py @@ -369,6 +369,10 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): while True: problem = randint(1, settings.PROBLEM_COUNT) + if await TeamDraw.objects.filter(participation_id=td.participation_id, + round__tournament=self.tournament, + round__number=1).aexists(): + continue if await pool.teamdraw_set.filter(accepted=problem).acount() < (2 if pool.size == 5 else 1): break