1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-29 13:41:04 +02:00

Display problem names

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-04 11:56:13 +02:00
parent 90bfc45858
commit 4357d51b9a
4 changed files with 23 additions and 12 deletions

View File

@ -382,7 +382,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
return await self.alert("This is not your turn.", 'danger')
while True:
problem = randint(1, settings.PROBLEM_COUNT)
problem = randint(1, len(settings.PROBLEMS))
if await TeamDraw.objects.filter(participation_id=td.participation_id,
round__draw__tournament=self.tournament,
round__number=1,
@ -431,7 +431,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
await td.asave()
trigram = await sync_to_async(lambda: td.participation.team.trigram)()
msg = f"L'équipe <strong>{trigram}</strong> a accepté le problème <strong>{td.accepted}</strong>. "
msg = f"L'équipe <strong>{trigram}</strong> a accepté le problème <strong>{td.accepted} : " \
f"{settings.PROBLEMS[td.accepted - 1]}</strong>. "
if pool.size == 5 and await pool.teamdraw_set.filter(accepted=td.accepted).acount() < 2:
msg += "Une équipe peut encore l'accepter."
else:
@ -574,10 +575,11 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
td.purposed = None
await td.asave()
remaining = settings.PROBLEM_COUNT - 5 - len(td.rejected)
remaining = len(settings.PROBLEMS) - 5 - len(td.rejected)
trigram = await sync_to_async(lambda: td.participation.team.trigram)()
msg = f"L'équipe <strong>{trigram}</strong> a refusé le problème <strong>{problem}</strong>. "
msg = f"L'équipe <strong>{trigram}</strong> a refusé le problème <strong>{problem} : " \
f"{settings.PROBLEMS[problem - 1]}</strong>. "
if remaining >= 0:
msg += f"Il lui reste {remaining} refus sans pénalité."
else: