Only consider a participant as a child if it is not 18 on the beginning of the tournament

This commit is contained in:
Yohann D'ANELLO 2021-01-23 14:30:00 +01:00
parent a0266c691b
commit 4dd3c105fe
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 7 additions and 1 deletions

View File

@ -159,7 +159,13 @@ class ParticipantRegistration(Registration):
@property @property
def under_18(self): def under_18(self):
return (timezone.now().date() - self.birth_date).days < 18 * 365.24 important_date = timezone.now().date()
if self.team and self.team.participation.tournament:
important_date = self.team.participation.tournament.date_start
if self.team.participation.final:
from participation.models import Tournament
important_date = Tournament.final_tournament().date_start
return (important_date - self.birth_date).days < 18 * 365.24
@property @property
def type(self): # pragma: no cover def type(self): # pragma: no cover