Fix under 18 calculus
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
a02697a3a7
commit
aca23eaf8b
|
@ -225,9 +225,9 @@ class ParticipantRegistration(Registration):
|
|||
if self.team and self.team.participation.tournament:
|
||||
important_date = self.team.participation.tournament.date_start
|
||||
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
|
||||
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)
|
||||
return important_date < over_18_on
|
||||
|
||||
|
@ -237,9 +237,10 @@ class ParticipantRegistration(Registration):
|
|||
return False # In normal case
|
||||
from participation.models import Tournament
|
||||
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
|
||||
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)
|
||||
return important_date < over_18_on
|
||||
|
||||
|
|
Loading…
Reference in New Issue