1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 06:22:22 +00:00

In a 5-teams pool, the order of two teams that present the same problem is random

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2023-03-26 11:38:27 +02:00
parent a4c7951475
commit 18bd2c7c18
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from collections import OrderedDict
from random import randint
from random import randint, shuffle
from asgiref.sync import sync_to_async
from channels.generic.websocket import AsyncJsonWebsocketConsumer
@ -452,6 +452,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
p_index = 0
for pb, tds in problems.items():
if len(tds) == 2:
# Le règlement demande à ce que l'ordre soit tiré au sort
shuffle(tds)
tds[0].passage_index = p_index
tds[1].passage_index = p_index + 1
p_index += 2