mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 18:22:24 +00:00
Add information to teams and juries about pools
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
c135da1f47
commit
572a6c3299
@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) 2020 by Animath
|
# Copyright (C) 2020 by Animath
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date, timedelta
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -698,7 +698,7 @@ class Participation(models.Model):
|
|||||||
'content': content,
|
'content': content,
|
||||||
})
|
})
|
||||||
|
|
||||||
if timezone.now() <= self.tournament.solution_limit:
|
if timezone.now() <= self.tournament.solution_limit + timedelta(hours=4):
|
||||||
text = _("<p>The solutions for the tournament of {tournament} are due on the {date:%Y-%m-%d %H:%M}.</p>"
|
text = _("<p>The solutions for the tournament of {tournament} are due on the {date:%Y-%m-%d %H:%M}.</p>"
|
||||||
"<p>You have currently sent <strong>{nb_solutions}</strong> solutions. "
|
"<p>You have currently sent <strong>{nb_solutions}</strong> solutions. "
|
||||||
"We suggest to send at least <strong>{min_solutions}</strong> different solutions.</p>"
|
"We suggest to send at least <strong>{min_solutions}</strong> different solutions.</p>"
|
||||||
@ -713,6 +713,94 @@ class Participation(models.Model):
|
|||||||
'priority': 1,
|
'priority': 1,
|
||||||
'content': content,
|
'content': content,
|
||||||
})
|
})
|
||||||
|
elif timezone.now() <= self.tournament.solutions_draw + timedelta(hours=4):
|
||||||
|
text = _("<p>The draw of the solutions for the tournament {tournament} is planned on the "
|
||||||
|
"{date:%Y-%m-%d %H:%M}. You can join it on <a href='{url}'>this link</a>.</p>")
|
||||||
|
url = reverse_lazy("draw:index")
|
||||||
|
content = format_lazy(text, tournament=self.tournament.name, date=self.tournament.solutions_draw, url=url)
|
||||||
|
informations.append({
|
||||||
|
'title': _("Draw of solutions"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 1,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
elif timezone.now() <= self.tournament.syntheses_first_phase_limit + timedelta(hours=4):
|
||||||
|
pool = self.pools.get(round=1, tournament=self.tournament)
|
||||||
|
defender_passage = pool.passages.get(defender=self)
|
||||||
|
opponent_passage = pool.passages.get(opponent=self)
|
||||||
|
reporter_passage = pool.passages.get(reporter=self)
|
||||||
|
|
||||||
|
defender_text = _("<p>The solutions draw is ended. You can check the result on "
|
||||||
|
"<a href={draw_url}>this page</a>.</p>"
|
||||||
|
"<p>For the first round, you will defend "
|
||||||
|
"<a href='{solution_url}'>your solution of the problem {problem}</a>.</p>")
|
||||||
|
draw_url = reverse_lazy("draw:index")
|
||||||
|
solution_url = reverse_lazy("participation:solution_detail", args=(defender_passage.defended_solution.pk,))
|
||||||
|
defender_content = format_lazy(defender_text, draw_url=draw_url,
|
||||||
|
solution_url=solution_url, problem=defender_passage.problem)
|
||||||
|
|
||||||
|
opponent_text = _("<p>You will oppose the solution of the team {opponent} on the problem {problem}. "
|
||||||
|
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||||
|
passage_url = reverse_lazy("participation:passage_detail", args=(opponent_passage.pk,))
|
||||||
|
opponent_content = format_lazy(opponent_text, opponent=opponent_passage.defender.team.trigram,
|
||||||
|
problem=opponent_passage.problem, passage_url=passage_url)
|
||||||
|
|
||||||
|
reporter_text = _("<p>You will report the solution of the team {reporter} on the problem {problem}. "
|
||||||
|
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||||
|
passage_url = reverse_lazy("participation:passage_detail", args=(reporter_passage.pk,))
|
||||||
|
reporter_content = format_lazy(reporter_text, reporter=reporter_passage.defender.team.trigram,
|
||||||
|
problem=reporter_passage.problem, passage_url=passage_url)
|
||||||
|
|
||||||
|
content = defender_content + opponent_content + reporter_content
|
||||||
|
informations.append({
|
||||||
|
'title': _("First round"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 1,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
elif timezone.now() <= self.tournament.syntheses_second_phase_limit + timedelta(hours=4):
|
||||||
|
pool = self.pools.get(round=2, tournament=self.tournament)
|
||||||
|
defender_passage = pool.passages.get(defender=self)
|
||||||
|
opponent_passage = pool.passages.get(opponent=self)
|
||||||
|
reporter_passage = pool.passages.get(reporter=self)
|
||||||
|
|
||||||
|
defender_text = _("<p>For the second round, you will defend "
|
||||||
|
"<a href='{solution_url}'>your solution of the problem {problem}</a>.</p>")
|
||||||
|
draw_url = reverse_lazy("draw:index")
|
||||||
|
solution_url = reverse_lazy("participation:solution_detail", args=(defender_passage.defended_solution.pk,))
|
||||||
|
defender_content = format_lazy(defender_text, draw_url=draw_url,
|
||||||
|
solution_url=solution_url, problem=defender_passage.problem)
|
||||||
|
|
||||||
|
opponent_text = _("<p>You will oppose the solution of the team {opponent} on the problem {problem}. "
|
||||||
|
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||||
|
passage_url = reverse_lazy("participation:passage_detail", args=(opponent_passage.pk,))
|
||||||
|
opponent_content = format_lazy(opponent_text, opponent=opponent_passage.defender.team.trigram,
|
||||||
|
problem=opponent_passage.problem, passage_url=passage_url)
|
||||||
|
|
||||||
|
reporter_text = _("<p>You will report the solution of the team {reporter} on the problem {problem}. "
|
||||||
|
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||||
|
passage_url = reverse_lazy("participation:passage_detail", args=(reporter_passage.pk,))
|
||||||
|
reporter_content = format_lazy(reporter_text, reporter=reporter_passage.defender.team.trigram,
|
||||||
|
problem=reporter_passage.problem, passage_url=passage_url)
|
||||||
|
|
||||||
|
content = defender_content + opponent_content + reporter_content
|
||||||
|
informations.append({
|
||||||
|
'title': _("Second round"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 1,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
elif not self.final:
|
||||||
|
text = _("<p>The tournament {tournament} is ended. You can check the results on the "
|
||||||
|
"<a href='{url}'>tournament page</a>.</p>")
|
||||||
|
url = reverse_lazy("participation:tournament_detail", args=(self.tournament.pk,))
|
||||||
|
content = format_lazy(text, tournament=self.tournament.name, url=url)
|
||||||
|
informations.append({
|
||||||
|
'title': _("Tournament ended"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 1,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
|
||||||
return informations
|
return informations
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ from django.utils.text import format_lazy
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from phonenumber_field.modelfields import PhoneNumberField
|
from phonenumber_field.modelfields import PhoneNumberField
|
||||||
from polymorphic.models import PolymorphicModel
|
from polymorphic.models import PolymorphicModel
|
||||||
|
|
||||||
|
from participation.models import Note
|
||||||
from tfjm import helloasso
|
from tfjm import helloasso
|
||||||
from tfjm.tokens import email_validation_token
|
from tfjm.tokens import email_validation_token
|
||||||
|
|
||||||
@ -513,6 +515,59 @@ class VolunteerRegistration(Registration):
|
|||||||
'content': content,
|
'content': content,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if timezone.now() > tournament.solution_limit and timezone.now() < tournament.solutions_draw:
|
||||||
|
text = _("<p>The draw of the solutions for the tournament {tournament} is planned on the "
|
||||||
|
"{date:%Y-%m-%d %H:%M}. You can join it on <a href='{url}'>this link</a>.</p>")
|
||||||
|
url = reverse_lazy("draw:index")
|
||||||
|
content = format_lazy(text, tournament=self.tournament.name, date=self.tournament.solutions_draw,
|
||||||
|
url=url)
|
||||||
|
informations.append({
|
||||||
|
'title': _("Draw of solutions"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 1,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
|
||||||
|
pools = tournament.pools.filter(juries=self).order_by('round').all()
|
||||||
|
for pool in pools:
|
||||||
|
if pool.round == 1 and timezone.now().date() <= tournament.date_start:
|
||||||
|
text = _("<p>You are in the jury of the pool {pool} for the tournament of {tournament}. "
|
||||||
|
"You can find the pool page <a href='{pool_url}'>here</a>.</p>")
|
||||||
|
pool_url = reverse_lazy("participation:pool_detail", args=(pool.id,))
|
||||||
|
content = format_lazy(text, pool=pool.short_name, tournament=tournament.name, pool_url=pool_url)
|
||||||
|
informations.append({
|
||||||
|
'title': _("First round"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 1,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
elif pool.round == 2 and timezone.now().date() <= tournament.date_end:
|
||||||
|
text = _("<p>You are in the jury of the pool {pool} for the tournament of {tournament}. "
|
||||||
|
"You can find the pool page <a href='{pool_url}'>here</a>.</p>")
|
||||||
|
pool_url = reverse_lazy("participation:pool_detail", args=(pool.id,))
|
||||||
|
content = format_lazy(text, pool=pool.short_name, tournament=tournament.name, pool_url=pool_url)
|
||||||
|
informations.append({
|
||||||
|
'title': _("Second round"),
|
||||||
|
'type': "info",
|
||||||
|
'priority': 2,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
|
||||||
|
for note in Note.objects.filter(jury=self.request.user, passage__pool=pool).all():
|
||||||
|
if not note.has_any_note():
|
||||||
|
text = _("<p>You don't have given any note as a jury for the passage {passage} "
|
||||||
|
"in the pool {pool} of {tournament}. "
|
||||||
|
"You can set your notes <a href='{passage_url}'>here</a>.</p>")
|
||||||
|
passage_url = reverse_lazy("participation:passage_detail", args=(note.passage.id,))
|
||||||
|
content = format_lazy(text, passage=note.passage.position, pool=pool.short_name,
|
||||||
|
tournament=tournament.name, passage_url=passage_url)
|
||||||
|
informations.append({
|
||||||
|
'title': _("Note"),
|
||||||
|
'type': "warning",
|
||||||
|
'priority': 3 + note.passage.position,
|
||||||
|
'content': content,
|
||||||
|
})
|
||||||
|
|
||||||
return informations
|
return informations
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
Loading…
Reference in New Issue
Block a user