Compare commits

...

3 Commits

Author SHA1 Message Date
Emmy D'Anello 3ca0148934
Update information about draw with the 2024 changes
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-04-19 19:02:11 +02:00
Emmy D'Anello 58608ea5ff
Add red background if the defender has at least one penalty
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-04-19 18:51:13 +02:00
Emmy D'Anello 68da61a33b
Fix script that generates data for second teams when there are 5 teams in the pool
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-04-19 18:38:19 +02:00
7 changed files with 24 additions and 21 deletions

View File

@ -502,8 +502,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
msg = "Les résultats des dés sont les suivants : "
msg += ", ".join(f"<strong>{td.participation.team.trigram}</strong> ({td.passage_dice})" for td in tds)
msg += ". L'ordre de passage et les compositions des différentes poules sont affiché⋅es sur le côté. "
msg += "Attention : les ordres de passage sont déterminés à partir des scores des dés, mais ne sont pas "
msg += "directement l'ordre croissant des dés, afin d'avoir des poules mélangées."
msg += "Les ordres de passage pour le premier tour sont déterminés à partir des scores des dés, "
msg += "dans l'ordre croissant. Pour le deuxième tour, les ordres de passage sont déterminés à partir "
msg += "des ordres de passage du premier tour."
self.tournament.draw.last_message = msg
await self.tournament.draw.asave()
@ -936,7 +937,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
if already_refused:
msg += "Cela n'ajoute pas de pénalité."
else:
msg += "Cela ajoute une pénalité de 0.5 sur le coefficient de l'oral de la défense."
msg += "Cela ajoute une pénalité de 25&nbsp;% sur le coefficient de l'oral de la défense."
self.tournament.draw.last_message = msg
await self.tournament.draw.asave()
@ -1018,7 +1019,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
r2 = await self.tournament.draw.round_set.filter(number=2).aget()
self.tournament.draw.current_round = r2
msg = "Le tirage au sort pour le tour 2 va commencer. " \
"L'ordre de passage est déterminé à partir du classement du premier tour."
"L'ordre de passage est déterminé à partir du classement du premier tour, " \
"de sorte à mélanger les équipes entre les deux jours."
self.tournament.draw.last_message = msg
await self.tournament.draw.asave()

View File

@ -148,7 +148,7 @@ class Draw(models.Model):
# The problem can be rejected
s += "Elle peut décider d'accepter ou de refuser ce problème. "
if len(td.rejected) >= len(settings.PROBLEMS) - 5:
s += "Refuser ce problème ajoutera une nouvelle pénalité de 0.5 sur le coefficient de l'oral de la défense."
s += "Refuser ce problème ajoutera une nouvelle pénalité de 25 % sur le coefficient de l'oral de la défense."
else:
s += f"Il reste {len(settings.PROBLEMS) - 5 - len(td.rejected)} refus sans pénalité."
case 'WAITING_FINAL':
@ -532,9 +532,9 @@ class TeamDraw(models.Model):
@property
def penalty(self):
"""
The penalty multiplier on the defender oral, which is a malus of 0.5 for each penalty.
The penalty multiplier on the defender oral, in percentage, which is a malus of 25% for each penalty.
"""
return 0.5 * self.penalty_int
return 25 * self.penalty_int
def __str__(self):
return str(format_lazy(_("Draw of the team {trigram} for the pool {letter}{number}"),

View File

@ -622,14 +622,14 @@ document.addEventListener('DOMContentLoaded', () => {
let penaltyDiv = document.getElementById(`recap-${tid}-round-${round}-team-${team}-penalty`)
if (rejected.length > problems_count - 5) {
// If more than P - 5 problems were rejected, add a penalty of 0.5 of the coefficient of the oral defender
// If more than P - 5 problems were rejected, add a penalty of 25% of the coefficient of the oral defender
if (penaltyDiv === null) {
penaltyDiv = document.createElement('div')
penaltyDiv.id = `recap-${tid}-round-${round}-team-${team}-penalty`
penaltyDiv.classList.add('badge', 'rounded-pill', 'text-bg-info')
recapDiv.parentNode.append(penaltyDiv)
}
penaltyDiv.textContent = `${0.5 * (rejected.length - (problems_count - 5))}`
penaltyDiv.textContent = `${25 * (rejected.length - (problems_count - 5))} %`
} else {
// Eventually remove this div
if (penaltyDiv !== null)

View File

@ -99,7 +99,7 @@
{# If needed, add the penalty of the team #}
<div id="recap-{{ tournament.id }}-round-{{ round.number }}-team-{{ td.participation.team.trigram }}-penalty"
class="badge rounded-pill text-bg-info">
❌ {{ td.penalty }}
❌ {{ td.penalty }} %
</div>
{% endif %}
</li>

View File

@ -7,7 +7,7 @@ from django.utils.translation import activate
import gspread
from gspread.utils import a1_range_to_grid_range, MergeType
from ...models import Tournament
from ...models import Passage, Tournament
class Command(BaseCommand):
@ -50,14 +50,14 @@ class Command(BaseCommand):
team2, score2 = sorted_notes[1]
team3, score3 = sorted_notes[2]
pool1 = tournament.pools.get(round=1, participations=team2)
defender_passage_1 = pool1.passages.get(defender=team2)
opponent_passage_1 = pool1.passages.get(opponent=team2)
reporter_passage_1 = pool1.passages.get(reporter=team2)
pool2 = tournament.pools.get(round=2, participations=team2)
defender_passage_2 = pool2.passages.get(defender=team2)
opponent_passage_2 = pool2.passages.get(opponent=team2)
reporter_passage_2 = pool2.passages.get(reporter=team2)
pool1 = tournament.pools.filter(round=1, participations=team2).first()
defender_passage_1 = Passage.objects.get(pool__tournament=tournament, pool__round=1, defender=team2)
opponent_passage_1 = Passage.objects.get(pool__tournament=tournament, pool__round=1, opponent=team2)
reporter_passage_1 = Passage.objects.get(pool__tournament=tournament, pool__round=1, reporter=team2)
pool2 = tournament.pools.filter(round=2, participations=team2).first()
defender_passage_2 = Passage.objects.get(pool__tournament=tournament, pool__round=2, defender=team2)
opponent_passage_2 = Passage.objects.get(pool__tournament=tournament, pool__round=2, opponent=team2)
reporter_passage_2 = Passage.objects.get(pool__tournament=tournament, pool__round=2, reporter=team2)
line.append(team2.team.trigram)
line.append(str(pool1.jury_president or ""))

View File

@ -866,7 +866,6 @@ class Participation(models.Model):
'content': content,
})
elif timezone.now() <= tournament.syntheses_second_phase_limit + timedelta(hours=2):
pool = self.pools.get(round=2, tournament=tournament)
defender_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=2, defender=self)
opponent_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=2, opponent=self)
reporter_passage = Passage.objects.get(pool__tournament=self.tournament, pool__round=2, reporter=self)
@ -1197,6 +1196,9 @@ class Pool(models.Model):
(f"C{max_row + 1}:{getcol(2 + passages.count() * passage_width)}{max_row + 3}", (0.9, 0.9, 0.9)),
(f"A{max_row + 5}:E{max_row + 5}", (0.8, 0.8, 0.8)),
(f"A{max_row + 6}:E{max_row + 5 + pool_size}", (0.9, 0.9, 0.9)),]
# Display penalties in red
bg_colors += [(f"{getcol(2 + (passage.position - 1) * passage_width + 2)}{max_row + 2}", (1.0, 0.7, 0.7))
for passage in self.passages.filter(defender_penalties__gte=1).all()]
for bg_range, bg_color in bg_colors:
r, g, b = bg_color
format_requests.append({

View File

@ -1660,7 +1660,6 @@ class PoolNotesTemplateView(VolunteerMixin, DetailView):
table.addElement(TableRow())
if self.object.participations.count() == 5:
# 5-teams pools are separated in two different objects.
# So, displaying the ranking may don't make any sens. We don't display it for this reason.