mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-02-06 14:13:06 +00:00
Don't manage pools of the second day with the dices of the first day since we consider the scores of the first day
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
feee5069b1
commit
b38302449c
@ -430,24 +430,27 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# This also determines the passage order, in the natural order this time.
|
# This also determines the passage order, in the natural order this time.
|
||||||
# If there is a 5-teams pool, we force the last team to be in the first pool,
|
# If there is a 5-teams pool, we force the last team to be in the first pool,
|
||||||
# which is this specific pool since they are ordered by decreasing size.
|
# which is this specific pool since they are ordered by decreasing size.
|
||||||
tds_copy = tds.copy()
|
# This is not true for the final tournament, which considers the scores of the
|
||||||
round2 = await self.tournament.draw.round_set.filter(number=2).aget()
|
# first round.
|
||||||
round2_pools = [p async for p in Pool.objects.filter(round__draw__tournament=self.tournament, round=round2)
|
if not self.tournament.final:
|
||||||
.order_by('letter').all()]
|
tds_copy = tds.copy()
|
||||||
current_pool_id, current_passage_index = 0, 0
|
round2 = await self.tournament.draw.round_set.filter(number=2).aget()
|
||||||
for i, td in enumerate(tds_copy):
|
round2_pools = [p async for p in Pool.objects.filter(round__draw__tournament=self.tournament, round=round2)
|
||||||
if i == len(tds) - 1 and round2_pools[0].size == 5:
|
.order_by('letter').all()]
|
||||||
current_pool_id = 0
|
current_pool_id, current_passage_index = 0, 0
|
||||||
current_passage_index = 4
|
for i, td in enumerate(tds_copy):
|
||||||
|
if i == len(tds) - 1 and round2_pools[0].size == 5:
|
||||||
|
current_pool_id = 0
|
||||||
|
current_passage_index = 4
|
||||||
|
|
||||||
td2 = await TeamDraw.objects.filter(participation=td.participation, round=round2).aget()
|
td2 = await TeamDraw.objects.filter(participation=td.participation, round=round2).aget()
|
||||||
td2.pool = round2_pools[current_pool_id]
|
td2.pool = round2_pools[current_pool_id]
|
||||||
td2.passage_index = current_passage_index
|
td2.passage_index = current_passage_index
|
||||||
current_pool_id += 1
|
current_pool_id += 1
|
||||||
if current_pool_id == len(round2_pools):
|
if current_pool_id == len(round2_pools):
|
||||||
current_pool_id = 0
|
current_pool_id = 0
|
||||||
current_passage_index += 1
|
current_passage_index += 1
|
||||||
await td2.asave()
|
await td2.asave()
|
||||||
|
|
||||||
# The current pool is the first pool of the current (first) round
|
# The current pool is the first pool of the current (first) round
|
||||||
pool = await Pool.objects.filter(round=self.tournament.draw.current_round, letter=1).aget()
|
pool = await Pool.objects.filter(round=self.tournament.draw.current_round, letter=1).aget()
|
||||||
|
@ -351,7 +351,7 @@
|
|||||||
{% trans "Are you sure you want to abort this draw?" %}
|
{% trans "Are you sure you want to abort this draw?" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" class="btn btn-danger" onclick="abortDraw({{ tournament.id }})">{% trans "Abort" %}</button>
|
<button type="submit" class="btn btn-danger" data-bs-dismiss="modal" onclick="abortDraw({{ tournament.id }})">{% trans "Abort" %}</button>
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user