mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 01:32:05 +01:00 
			
		
		
		
	Display informations about the final tournament in the sidebar
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -718,34 +718,59 @@ class Participation(models.Model):
 | 
				
			|||||||
                'content': content,
 | 
					                'content': content,
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if timezone.now() <= self.tournament.solution_limit + timedelta(hours=2):
 | 
					        if self.tournament:
 | 
				
			||||||
            text = _("<p>The solutions for the tournament of {tournament} are due on the {date:%Y-%m-%d %H:%M}.</p>"
 | 
					            informations.extend(self.informations_for_tournament(self.tournament))
 | 
				
			||||||
                     "<p>You have currently sent <strong>{nb_solutions}</strong> solutions. "
 | 
					            if self.final:
 | 
				
			||||||
                     "We suggest to send at least <strong>{min_solutions}</strong> different solutions.</p>"
 | 
					                informations.extend(self.informations_for_tournament(Tournament.final_tournament()))
 | 
				
			||||||
                     "<p>You can upload your solutions on <a href='{url}'>your participation page</a>.</p>")
 | 
					
 | 
				
			||||||
            url = reverse_lazy("participation:participation_detail", args=(self.pk,))
 | 
					        return informations
 | 
				
			||||||
            content = format_lazy(text, tournament=self.tournament.name, date=localtime(self.tournament.solution_limit),
 | 
					
 | 
				
			||||||
                                  nb_solutions=self.solutions.count(), min_solutions=len(settings.PROBLEMS) - 3,
 | 
					    def informations_for_tournament(self, tournament) -> list[dict]:
 | 
				
			||||||
                                  url=url)
 | 
					        informations = []
 | 
				
			||||||
            informations.append({
 | 
					        if timezone.now() <= tournament.solution_limit + timedelta(hours=2):
 | 
				
			||||||
                'title': _("Solutions due"),
 | 
					            if not tournament.final:
 | 
				
			||||||
                'type': "info",
 | 
					                text = _("<p>The solutions for the tournament of {tournament} are due on the {date:%Y-%m-%d %H:%M}.</p>"
 | 
				
			||||||
                'priority': 1,
 | 
					                         "<p>You have currently sent <strong>{nb_solutions}</strong> solutions. "
 | 
				
			||||||
                'content': content,
 | 
					                         "We suggest to send at least <strong>{min_solutions}</strong> different solutions.</p>"
 | 
				
			||||||
            })
 | 
					                         "<p>You can upload your solutions on <a href='{url}'>your participation page</a>.</p>")
 | 
				
			||||||
        elif timezone.now() <= self.tournament.solutions_draw + timedelta(hours=2):
 | 
					                url = reverse_lazy("participation:participation_detail", args=(self.pk,))
 | 
				
			||||||
 | 
					                content = format_lazy(text, tournament=tournament.name, date=localtime(tournament.solution_limit),
 | 
				
			||||||
 | 
					                                      nb_solutions=self.solutions.filter(final_solution=False).count(),
 | 
				
			||||||
 | 
					                                      min_solutions=len(settings.PROBLEMS) - 3,
 | 
				
			||||||
 | 
					                                      url=url)
 | 
				
			||||||
 | 
					                informations.append({
 | 
				
			||||||
 | 
					                    'title': _("Solutions due"),
 | 
				
			||||||
 | 
					                    'type': "info",
 | 
				
			||||||
 | 
					                    'priority': 1,
 | 
				
			||||||
 | 
					                    'content': content,
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                text = _("<p>The solutions for the tournament of {tournament} are due on the {date:%Y-%m-%d %H:%M}.</p>"
 | 
				
			||||||
 | 
					                         "<p>Remember that you can only fix minor changes to your solutions "
 | 
				
			||||||
 | 
					                         "without adding new parts.</p>"
 | 
				
			||||||
 | 
					                         "<p>You can upload your solutions on <a href='{url}'>your participation page</a>.</p>")
 | 
				
			||||||
 | 
					                url = reverse_lazy("participation:participation_detail", args=(self.pk,))
 | 
				
			||||||
 | 
					                content = format_lazy(text, tournament=tournament.name, date=localtime(tournament.solution_limit),
 | 
				
			||||||
 | 
					                                      url=url)
 | 
				
			||||||
 | 
					                informations.append({
 | 
				
			||||||
 | 
					                    'title': _("Solutions due"),
 | 
				
			||||||
 | 
					                    'type': "info",
 | 
				
			||||||
 | 
					                    'priority': 1,
 | 
				
			||||||
 | 
					                    'content': content,
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					        elif timezone.now() <= tournament.solutions_draw + timedelta(hours=2):
 | 
				
			||||||
            text = _("<p>The draw of the solutions for the tournament {tournament} is planned on the "
 | 
					            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>")
 | 
					                     "{date:%Y-%m-%d %H:%M}. You can join it on <a href='{url}'>this link</a>.</p>")
 | 
				
			||||||
            url = reverse_lazy("draw:index")
 | 
					            url = reverse_lazy("draw:index")
 | 
				
			||||||
            content = format_lazy(text, tournament=self.tournament.name,
 | 
					            content = format_lazy(text, tournament=tournament.name,
 | 
				
			||||||
                                  date=localtime(self.tournament.solutions_draw), url=url)
 | 
					                                  date=localtime(tournament.solutions_draw), url=url)
 | 
				
			||||||
            informations.append({
 | 
					            informations.append({
 | 
				
			||||||
                'title': _("Draw of solutions"),
 | 
					                'title': _("Draw of solutions"),
 | 
				
			||||||
                'type': "info",
 | 
					                'type': "info",
 | 
				
			||||||
                'priority': 1,
 | 
					                'priority': 1,
 | 
				
			||||||
                'content': content,
 | 
					                'content': content,
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        elif timezone.now() <= self.tournament.syntheses_first_phase_limit + timedelta(hours=2):
 | 
					        elif timezone.now() <= tournament.syntheses_first_phase_limit + timedelta(hours=2):
 | 
				
			||||||
            pool = self.pools.get(round=1, tournament=self.tournament)
 | 
					            pool = self.pools.get(round=1, tournament=self.tournament)
 | 
				
			||||||
            defender_passage = pool.passages.get(defender=self)
 | 
					            defender_passage = pool.passages.get(defender=self)
 | 
				
			||||||
            opponent_passage = pool.passages.get(opponent=self)
 | 
					            opponent_passage = pool.passages.get(opponent=self)
 | 
				
			||||||
@@ -790,8 +815,8 @@ class Participation(models.Model):
 | 
				
			|||||||
                'priority': 1,
 | 
					                'priority': 1,
 | 
				
			||||||
                'content': content,
 | 
					                'content': content,
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        elif timezone.now() <= self.tournament.syntheses_second_phase_limit + timedelta(hours=2):
 | 
					        elif timezone.now() <= tournament.syntheses_second_phase_limit + timedelta(hours=2):
 | 
				
			||||||
            pool = self.pools.get(round=2, tournament=self.tournament)
 | 
					            pool = self.pools.get(round=2, tournament=tournament)
 | 
				
			||||||
            defender_passage = pool.passages.get(defender=self)
 | 
					            defender_passage = pool.passages.get(defender=self)
 | 
				
			||||||
            opponent_passage = pool.passages.get(opponent=self)
 | 
					            opponent_passage = pool.passages.get(opponent=self)
 | 
				
			||||||
            reporter_passage = pool.passages.get(reporter=self)
 | 
					            reporter_passage = pool.passages.get(reporter=self)
 | 
				
			||||||
@@ -833,11 +858,11 @@ class Participation(models.Model):
 | 
				
			|||||||
                'priority': 1,
 | 
					                'priority': 1,
 | 
				
			||||||
                'content': content,
 | 
					                'content': content,
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        elif not self.final:
 | 
					        elif not self.final or tournament.final:
 | 
				
			||||||
            text = _("<p>The tournament {tournament} is ended. You can check the results on the "
 | 
					            text = _("<p>The tournament {tournament} is ended. You can check the results on the "
 | 
				
			||||||
                     "<a href='{url}'>tournament page</a>.</p>")
 | 
					                     "<a href='{url}'>tournament page</a>.</p>")
 | 
				
			||||||
            url = reverse_lazy("participation:tournament_detail", args=(self.tournament.pk,))
 | 
					            url = reverse_lazy("participation:tournament_detail", args=(tournament.pk,))
 | 
				
			||||||
            content = format_lazy(text, tournament=self.tournament.name, url=url)
 | 
					            content = format_lazy(text, tournament=tournament.name, url=url)
 | 
				
			||||||
            informations.append({
 | 
					            informations.append({
 | 
				
			||||||
                'title': _("Tournament ended"),
 | 
					                'title': _("Tournament ended"),
 | 
				
			||||||
                'type': "info",
 | 
					                'type': "info",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -272,6 +272,19 @@ class ParticipantRegistration(Registration):
 | 
				
			|||||||
                        'content': content,
 | 
					                        'content': content,
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if self.team.participation.final:
 | 
				
			||||||
 | 
					                    if not self.photo_authorization_final:
 | 
				
			||||||
 | 
					                        text = _("You have not uploaded your photo authorization for the final tournament. "
 | 
				
			||||||
 | 
					                                 "You can do it by clicking on <a href=\"{photo_url}\">this link</a>.")
 | 
				
			||||||
 | 
					                        photo_url = reverse_lazy("registration:upload_user_photo_authorization_final", args=(self.id,))
 | 
				
			||||||
 | 
					                        content = format_lazy(text, photo_url=photo_url)
 | 
				
			||||||
 | 
					                        informations.append({
 | 
				
			||||||
 | 
					                            'title': _("Photo authorization"),
 | 
				
			||||||
 | 
					                            'type': "danger",
 | 
				
			||||||
 | 
					                            'priority': 5,
 | 
				
			||||||
 | 
					                            'content': content,
 | 
				
			||||||
 | 
					                        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            informations.extend(self.team.important_informations())
 | 
					            informations.extend(self.team.important_informations())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return informations
 | 
					        return informations
 | 
				
			||||||
@@ -419,6 +432,20 @@ class StudentRegistration(ParticipantRegistration):
 | 
				
			|||||||
                        'content': content,
 | 
					                        'content': content,
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if self.team.participation.final:
 | 
				
			||||||
 | 
					                if self.under_18_final and not self.parental_authorization_final:
 | 
				
			||||||
 | 
					                    text = _("You have not uploaded your parental authorization for the final tournament. "
 | 
				
			||||||
 | 
					                             "You can do it by clicking on <a href=\"{parental_url}\">this link</a>.")
 | 
				
			||||||
 | 
					                    parental_url = reverse_lazy("registration:upload_user_parental_authorization_final",
 | 
				
			||||||
 | 
					                                                args=(self.id,))
 | 
				
			||||||
 | 
					                    content = format_lazy(text, parental_url=parental_url)
 | 
				
			||||||
 | 
					                    informations.append({
 | 
				
			||||||
 | 
					                        'title': _("Parental authorization"),
 | 
				
			||||||
 | 
					                        'type': "danger",
 | 
				
			||||||
 | 
					                        'priority': 5,
 | 
				
			||||||
 | 
					                        'content': content,
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return informations
 | 
					        return informations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class Meta:
 | 
					    class Meta:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,8 +31,8 @@ from tfjm.tokens import email_validation_token
 | 
				
			|||||||
from tfjm.views import UserMixin, UserRegistrationMixin, VolunteerMixin
 | 
					from tfjm.views import UserMixin, UserRegistrationMixin, VolunteerMixin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .forms import AddOrganizerForm, CoachRegistrationForm, HealthSheetForm, \
 | 
					from .forms import AddOrganizerForm, CoachRegistrationForm, HealthSheetForm, \
 | 
				
			||||||
    PhotoAuthorizationFinalForm, ParentalAuthorizationForm, PaymentAdminForm, PaymentForm, \
 | 
					    ParentalAuthorizationFinalForm, ParentalAuthorizationForm, PaymentAdminForm, PaymentForm, \
 | 
				
			||||||
    ParentalAuthorizationFinalForm, PhotoAuthorizationForm, SignupForm, StudentRegistrationForm, UserForm, \
 | 
					    PhotoAuthorizationFinalForm, PhotoAuthorizationForm, SignupForm, StudentRegistrationForm, UserForm, \
 | 
				
			||||||
    VaccineSheetForm, VolunteerRegistrationForm
 | 
					    VaccineSheetForm, VolunteerRegistrationForm
 | 
				
			||||||
from .models import ParticipantRegistration, Payment, Registration, StudentRegistration
 | 
					from .models import ParticipantRegistration, Payment, Registration, StudentRegistration
 | 
				
			||||||
from .tables import RegistrationTable
 | 
					from .tables import RegistrationTable
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user