From aca23eaf8b51c56e5649ee2c5ddbf1aff6cc3c7e Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Tue, 9 Apr 2024 17:44:15 +0200 Subject: [PATCH] Fix under 18 calculus Signed-off-by: Emmy D'Anello --- registration/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/registration/models.py b/registration/models.py index 0022696..dbef800 100644 --- a/registration/models.py +++ b/registration/models.py @@ -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