From 18bd2c7c184c5e2dc2f3c9f1c31c1e99752d6b91 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 26 Mar 2023 11:38:27 +0200 Subject: [PATCH] In a 5-teams pool, the order of two teams that present the same problem is random Signed-off-by: Emmy D'Anello --- draw/consumers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/draw/consumers.py b/draw/consumers.py index 1101c85..9ac7b5c 100644 --- a/draw/consumers.py +++ b/draw/consumers.py @@ -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