mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 14:32:19 +01:00 
			
		
		
		
	Add information to teams and juries about pools
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
# Copyright (C) 2020 by Animath
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
from datetime import date
 | 
			
		||||
from datetime import date, timedelta
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
@@ -698,7 +698,7 @@ class Participation(models.Model):
 | 
			
		||||
                '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>"
 | 
			
		||||
                     "<p>You have currently sent <strong>{nb_solutions}</strong> solutions. "
 | 
			
		||||
                     "We suggest to send at least <strong>{min_solutions}</strong> different solutions.</p>"
 | 
			
		||||
@@ -713,6 +713,94 @@ 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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user