1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 17:42:24 +00:00

Fix under 18 calculus

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-04-09 17:44:15 +02:00
parent a02697a3a7
commit aca23eaf8b
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -225,9 +225,9 @@ class ParticipantRegistration(Registration):
if self.team and self.team.participation.tournament: if self.team and self.team.participation.tournament:
important_date = self.team.participation.tournament.date_start important_date = self.team.participation.tournament.date_start
birth_date = self.birth_date birth_date = self.birth_date
if self.birth_date.month == 2 and self.birth_date.day == 29: if birth_date.month == 2 and birth_date.day == 29:
# If the birth date is the 29th of February, we consider it as the 1st of March # If the birth date is the 29th of February, we consider it as the 1st of March
birth_date = important_date.replace(month=3, day=1) birth_date = birth_date.replace(month=3, day=1)
over_18_on = birth_date.replace(year=birth_date.year + 18) over_18_on = birth_date.replace(year=birth_date.year + 18)
return important_date < over_18_on return important_date < over_18_on
@ -237,9 +237,10 @@ class ParticipantRegistration(Registration):
return False # In normal case return False # In normal case
from participation.models import Tournament from participation.models import Tournament
important_date = Tournament.final_tournament().date_start important_date = Tournament.final_tournament().date_start
if self.birth_date.month == 2 and self.birth_date.day == 29: birth_date = self.birth_date
if birth_date.month == 2 and birth_date.day == 29:
# If the birth date is the 29th of February, we consider it as the 1st of March # If the birth date is the 29th of February, we consider it as the 1st of March
birth_date = important_date.replace(month=3, day=1) birth_date = birth_date.replace(month=3, day=1)
over_18_on = birth_date.replace(year=birth_date.year + 18) over_18_on = birth_date.replace(year=birth_date.year + 18)
return important_date < over_18_on return important_date < over_18_on