Fix the drawing resume for the final
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
b38302449c
commit
9bc0e99d6d
|
@ -988,8 +988,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||||
async for participation in self.tournament.participations.filter(valid=True).prefetch_related('team').all():
|
async for participation in self.tournament.participations.filter(valid=True).prefetch_related('team').all():
|
||||||
notes[participation] = sum([await pool.aaverage(participation)
|
notes[participation] = sum([await pool.aaverage(participation)
|
||||||
async for pool in self.tournament.pools.filter(participations=participation)
|
async for pool in self.tournament.pools.filter(participations=participation)
|
||||||
.prefetch_related('passages').prefetch_related('tweaks')
|
.prefetch_related('passages')])
|
||||||
if pool.results_available])
|
|
||||||
# Sort notes in a decreasing order
|
# Sort notes in a decreasing order
|
||||||
ordered_participations = sorted(notes.keys(), key=lambda x: -notes[x])
|
ordered_participations = sorted(notes.keys(), key=lambda x: -notes[x])
|
||||||
# Define pools and passage orders from the ranking of the first round
|
# Define pools and passage orders from the ranking of the first round
|
||||||
|
@ -1368,7 +1367,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||||
else:
|
else:
|
||||||
# Don't continue the final tournament
|
# Don't continue the final tournament
|
||||||
r1 = await self.tournament.draw.round_set \
|
r1 = await self.tournament.draw.round_set \
|
||||||
.prefetch_related('current_pool__current__team__participation__team').aget(number=1)
|
.prefetch_related('current_pool__current_team__participation__team').aget(number=1)
|
||||||
self.tournament.draw.current_round = r1
|
self.tournament.draw.current_round = r1
|
||||||
await self.tournament.draw.asave()
|
await self.tournament.draw.asave()
|
||||||
|
|
||||||
|
@ -1378,6 +1377,19 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||||
td.choice_dice = None
|
td.choice_dice = None
|
||||||
await td.asave()
|
await td.asave()
|
||||||
|
|
||||||
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
|
{
|
||||||
|
'tid': self.tournament_id,
|
||||||
|
'type': 'draw.send_poules',
|
||||||
|
'round': 2, 'poules': [
|
||||||
|
{
|
||||||
|
'letter': pool.get_letter_display(),
|
||||||
|
'teams': [],
|
||||||
|
}
|
||||||
|
async for pool in r.pool_set.order_by('letter').all()
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
async for td in r1.team_draws.prefetch_related('participation__team').all():
|
async for td in r1.team_draws.prefetch_related('participation__team').all():
|
||||||
await self.channel_layer.group_send(
|
await self.channel_layer.group_send(
|
||||||
f"tournament-{self.tournament.id}", {'tid': self.tournament_id, 'type': 'draw.dice',
|
f"tournament-{self.tournament.id}", {'tid': self.tournament_id, 'type': 'draw.dice',
|
||||||
|
|
|
@ -323,49 +323,44 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
li.append(title, teamList)
|
li.append(title, teamList)
|
||||||
poolList.append(li)
|
poolList.append(li)
|
||||||
}
|
}
|
||||||
|
teamList.innerHTML = ""
|
||||||
|
|
||||||
if (poule.teams.length > 0) {
|
for (let team of poule.teams) {
|
||||||
// The pool is initialized
|
// Reorder dices
|
||||||
for (let team of poule.teams) {
|
let diceDiv = document.getElementById(`dice-${tid}-${team}`)
|
||||||
// Reorder dices
|
diceDiv.parentElement.style.order = c.toString()
|
||||||
let diceDiv = document.getElementById(`dice-${tid}-${team}`)
|
c += 1
|
||||||
diceDiv.parentElement.style.order = c.toString()
|
|
||||||
c += 1
|
|
||||||
|
|
||||||
let teamLiId = `recap-${tid}-round-${round}-team-${team}`
|
let teamLiId = `recap-${tid}-round-${round}-team-${team}`
|
||||||
let teamLi = document.getElementById(teamLiId)
|
|
||||||
|
|
||||||
if (teamLi === null) {
|
// Add a line for the team in the recap
|
||||||
// Add a line for the team in the recap
|
let teamLi = document.createElement('li')
|
||||||
teamLi = document.createElement('li')
|
teamLi.id = teamLiId
|
||||||
teamLi.id = teamLiId
|
teamLi.classList.add('list-group-item')
|
||||||
teamLi.classList.add('list-group-item')
|
teamLi.setAttribute('data-tournament', tid)
|
||||||
teamLi.setAttribute('data-tournament', tid)
|
|
||||||
|
|
||||||
teamList.append(teamLi)
|
teamList.append(teamLi)
|
||||||
}
|
|
||||||
|
|
||||||
// Add the accepted problem div (empty for now)
|
// Add the accepted problem div (empty for now)
|
||||||
let acceptedDivId = `recap-${tid}-round-${round}-team-${team}-accepted`
|
let acceptedDivId = `recap-${tid}-round-${round}-team-${team}-accepted`
|
||||||
let acceptedDiv = document.getElementById(acceptedDivId)
|
let acceptedDiv = document.getElementById(acceptedDivId)
|
||||||
if (acceptedDiv === null) {
|
if (acceptedDiv === null) {
|
||||||
acceptedDiv = document.createElement('div')
|
acceptedDiv = document.createElement('div')
|
||||||
acceptedDiv.id = acceptedDivId
|
acceptedDiv.id = acceptedDivId
|
||||||
acceptedDiv.classList.add('badge', 'rounded-pill', 'text-bg-warning')
|
acceptedDiv.classList.add('badge', 'rounded-pill', 'text-bg-warning')
|
||||||
acceptedDiv.textContent = `${team} 📃 ?`
|
acceptedDiv.textContent = `${team} 📃 ?`
|
||||||
teamLi.append(acceptedDiv)
|
teamLi.append(acceptedDiv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the rejected problems div (empty for now)
|
// Add the rejected problems div (empty for now)
|
||||||
let rejectedDivId = `recap-${tid}-round-${round}-team-${team}-rejected`
|
let rejectedDivId = `recap-${tid}-round-${round}-team-${team}-rejected`
|
||||||
let rejectedDiv = document.getElementById(rejectedDivId)
|
let rejectedDiv = document.getElementById(rejectedDivId)
|
||||||
if (rejectedDiv === null) {
|
if (rejectedDiv === null) {
|
||||||
rejectedDiv = document.createElement('div')
|
rejectedDiv = document.createElement('div')
|
||||||
rejectedDiv.id = rejectedDivId
|
rejectedDiv.id = rejectedDivId
|
||||||
rejectedDiv.classList.add('badge', 'rounded-pill', 'text-bg-danger')
|
rejectedDiv.classList.add('badge', 'rounded-pill', 'text-bg-danger')
|
||||||
rejectedDiv.textContent = '🗑️'
|
rejectedDiv.textContent = '🗑️'
|
||||||
teamLi.append(rejectedDiv)
|
teamLi.append(rejectedDiv)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue