From 21c4d5d7f57076027e169b22b9073524b174474e Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Wed, 17 Apr 2024 00:02:02 +0200 Subject: [PATCH] Exchange first and last teams if there is only one pool (event if there are only 3 or 4 teams) Signed-off-by: Emmy D'Anello --- draw/consumers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/draw/consumers.py b/draw/consumers.py index c54575f..af3a919 100644 --- a/draw/consumers.py +++ b/draw/consumers.py @@ -456,10 +456,10 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): td2 = await TeamDraw.objects.filter(participation=td.participation, round=round2).aget() td2.pool = round2_pools[current_pool_id] td2.passage_index = current_passage_index - if len(round2_pools) == 1 and len(tds) == 5: - # Exchange teams 1 and 5 if there is only one pool with 5 teams - if i == 0 or i == 4: - td2.passage_index = 4 - i + if len(round2_pools) == 1: + # Exchange first and last team if there is only one pool + if i == 0 or i == len(tds) - 1: + td2.passage_index = len(tds) - 1 - i current_passage_index += 1 await td2.asave()