mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-02-24 13:41:19 +00:00
Compare commits
No commits in common. "29b01ebb132b1a30d6892363f394dd97495e4bd2" and "c135da1f47e24b06d6c22d97d4d914564706bb74" have entirely different histories.
29b01ebb13
...
c135da1f47
@ -347,7 +347,7 @@ class Pool(models.Model):
|
||||
Translates this Pool instance in a :model:`participation.Pool` instance, with the passage orders.
|
||||
"""
|
||||
# Create the pool
|
||||
self.associated_pool, _created = await PPool.objects.aget_or_create(
|
||||
self.associated_pool = await PPool.objects.acreate(
|
||||
tournament=self.round.draw.tournament,
|
||||
round=self.round.number,
|
||||
letter=self.letter,
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from datetime import date, timedelta
|
||||
from datetime import date
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
@ -698,7 +698,7 @@ class Participation(models.Model):
|
||||
'content': content,
|
||||
})
|
||||
|
||||
if timezone.now() <= self.tournament.solution_limit + timedelta(hours=4):
|
||||
if timezone.now() <= self.tournament.solution_limit:
|
||||
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. "
|
||||
"We suggest to send at least <strong>{min_solutions}</strong> different solutions.</p>"
|
||||
@ -713,94 +713,6 @@ class Participation(models.Model):
|
||||
'priority': 1,
|
||||
'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
|
||||
|
||||
|
@ -513,59 +513,6 @@ class VolunteerRegistration(Registration):
|
||||
'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 self.notes.filter(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
|
||||
|
||||
class Meta:
|
||||
|
Loading…
x
Reference in New Issue
Block a user