mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 03:02:23 +00:00
Display problem names
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
90bfc45858
commit
4357d51b9a
@ -382,7 +382,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||
return await self.alert("This is not your turn.", 'danger')
|
||||
|
||||
while True:
|
||||
problem = randint(1, settings.PROBLEM_COUNT)
|
||||
problem = randint(1, len(settings.PROBLEMS))
|
||||
if await TeamDraw.objects.filter(participation_id=td.participation_id,
|
||||
round__draw__tournament=self.tournament,
|
||||
round__number=1,
|
||||
@ -431,7 +431,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||
await td.asave()
|
||||
|
||||
trigram = await sync_to_async(lambda: td.participation.team.trigram)()
|
||||
msg = f"L'équipe <strong>{trigram}</strong> a accepté le problème <strong>{td.accepted}</strong>. "
|
||||
msg = f"L'équipe <strong>{trigram}</strong> a accepté le problème <strong>{td.accepted} : " \
|
||||
f"{settings.PROBLEMS[td.accepted - 1]}</strong>. "
|
||||
if pool.size == 5 and await pool.teamdraw_set.filter(accepted=td.accepted).acount() < 2:
|
||||
msg += "Une équipe peut encore l'accepter."
|
||||
else:
|
||||
@ -574,10 +575,11 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
||||
td.purposed = None
|
||||
await td.asave()
|
||||
|
||||
remaining = settings.PROBLEM_COUNT - 5 - len(td.rejected)
|
||||
remaining = len(settings.PROBLEMS) - 5 - len(td.rejected)
|
||||
|
||||
trigram = await sync_to_async(lambda: td.participation.team.trigram)()
|
||||
msg = f"L'équipe <strong>{trigram}</strong> a refusé le problème <strong>{problem}</strong>. "
|
||||
msg = f"L'équipe <strong>{trigram}</strong> a refusé le problème <strong>{problem} : " \
|
||||
f"{settings.PROBLEMS[problem - 1]}</strong>. "
|
||||
if remaining >= 0:
|
||||
msg += f"Il lui reste {remaining} refus sans pénalité."
|
||||
else:
|
||||
|
@ -96,10 +96,10 @@ class Draw(models.Model):
|
||||
tirer un nouveau problème immédiatement, ou bien revenir sur son choix."""
|
||||
else:
|
||||
s += "Elle peut décider d'accepter ou de refuser ce problème. "
|
||||
if len(td.rejected) >= settings.PROBLEM_COUNT - 5:
|
||||
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 læ défenseur⋅se."
|
||||
else:
|
||||
s += f"Il reste {settings.PROBLEM_COUNT - 5 - len(td.rejected)} refus sans pénalité."
|
||||
s += f"Il reste {len(settings.PROBLEMS) - 5 - len(td.rejected)} refus sans pénalité."
|
||||
case 'WAITING_FINAL':
|
||||
s += "Le tirage au sort pour le tour 2 aura lieu à la fin du premier tour. Bon courage !"
|
||||
case 'DRAW_ENDED':
|
||||
@ -318,7 +318,7 @@ class TeamDraw(models.Model):
|
||||
|
||||
accepted = models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, settings.PROBLEM_COUNT + 1)
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, len(settings.PROBLEMS) + 1)
|
||||
],
|
||||
null=True,
|
||||
default=None,
|
||||
@ -341,7 +341,7 @@ class TeamDraw(models.Model):
|
||||
|
||||
purposed = models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, settings.PROBLEM_COUNT + 1)
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, len(settings.PROBLEMS) + 1)
|
||||
],
|
||||
null=True,
|
||||
default=None,
|
||||
@ -359,7 +359,7 @@ class TeamDraw(models.Model):
|
||||
|
||||
@property
|
||||
def penalty_int(self):
|
||||
return max(0, len(self.rejected) - (settings.PROBLEM_COUNT - 5))
|
||||
return max(0, len(self.rejected) - (len(settings.PROBLEMS) - 5))
|
||||
|
||||
@property
|
||||
def penalty(self):
|
||||
|
@ -431,7 +431,7 @@ class Passage(models.Model):
|
||||
solution_number = models.PositiveSmallIntegerField(
|
||||
verbose_name=_("defended solution"),
|
||||
choices=[
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, settings.PROBLEM_COUNT + 1)
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, len(settings.PROBLEMS) + 1)
|
||||
],
|
||||
)
|
||||
|
||||
@ -585,7 +585,7 @@ class Solution(models.Model):
|
||||
problem = models.PositiveSmallIntegerField(
|
||||
verbose_name=_("problem"),
|
||||
choices=[
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, settings.PROBLEM_COUNT + 1)
|
||||
(i, format_lazy(_("Problem #{problem}"), problem=i)) for i in range(1, len(settings.PROBLEMS) + 1)
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -234,7 +234,16 @@ PHONENUMBER_DEFAULT_REGION = 'FR'
|
||||
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
||||
|
||||
# Custom parameters
|
||||
PROBLEM_COUNT = 8
|
||||
PROBLEMS = [
|
||||
"Philatélie",
|
||||
"La montagne aux ruisseaux",
|
||||
"Appoint monétaire",
|
||||
"Musique déformée",
|
||||
"Angles entiers",
|
||||
"Tribus hiérarchiques",
|
||||
"Miroirs et lasers",
|
||||
"Graine de deck",
|
||||
]
|
||||
FORBIDDEN_TRIGRAMS = [
|
||||
"BIT",
|
||||
"CNO",
|
||||
|
Loading…
Reference in New Issue
Block a user