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
1 changed files with 3 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from collections import OrderedDict from collections import OrderedDict
from random import randint from random import randint, shuffle
from asgiref.sync import sync_to_async from asgiref.sync import sync_to_async
from channels.generic.websocket import AsyncJsonWebsocketConsumer from channels.generic.websocket import AsyncJsonWebsocketConsumer
@ -452,6 +452,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
p_index = 0 p_index = 0
for pb, tds in problems.items(): for pb, tds in problems.items():
if len(tds) == 2: 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[0].passage_index = p_index
tds[1].passage_index = p_index + 1 tds[1].passage_index = p_index + 1
p_index += 2 p_index += 2