|
|
|
@ -206,6 +206,14 @@ class Tournament(models.Model): |
|
|
|
summons.sort(key=lambda s: s.date) |
|
|
|
summons.sort(key=lambda s: s.date) |
|
|
|
return summons |
|
|
|
return summons |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def has_summons(self): |
|
|
|
|
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
|
|
|
|
if team_registration.is_valid_for_summon(): |
|
|
|
|
|
|
|
next_match = team_registration.next_match() |
|
|
|
|
|
|
|
if next_match and next_match.start_date is not None: |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
def rankings(self): |
|
|
|
def rankings(self): |
|
|
|
rankings = [] |
|
|
|
rankings = [] |
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
@ -552,34 +560,33 @@ class Tournament(models.Model): |
|
|
|
def display_tournament(self): |
|
|
|
def display_tournament(self): |
|
|
|
if self.publish_tournament: |
|
|
|
if self.publish_tournament: |
|
|
|
return True |
|
|
|
return True |
|
|
|
is_build_and_not_empty = self.is_build_and_not_empty() |
|
|
|
# is_build_and_not_empty = self.is_build_and_not_empty() |
|
|
|
if self.end_date is not None: |
|
|
|
if self.end_date is not None: |
|
|
|
if self.is_canceled is True: |
|
|
|
|
|
|
|
return is_build_and_not_empty |
|
|
|
|
|
|
|
return True |
|
|
|
return True |
|
|
|
if is_build_and_not_empty is True: |
|
|
|
if datetime.now().date() >= self.start_date.date(): |
|
|
|
if datetime.now().date() >= self.start_date.date(): |
|
|
|
return True |
|
|
|
return True |
|
|
|
minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) |
|
|
|
minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) |
|
|
|
return timezone.now() >= minimum_publish_date |
|
|
|
return timezone.now() >= minimum_publish_date |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_teams(self): |
|
|
|
def display_teams(self): |
|
|
|
if self.end_date is not None: |
|
|
|
if self.end_date is not None: |
|
|
|
return True |
|
|
|
return self.has_team_registrations() |
|
|
|
if self.publish_teams: |
|
|
|
if self.publish_teams: |
|
|
|
return True |
|
|
|
return self.has_team_registrations() |
|
|
|
if timezone.now().date() >= self.start_date.date(): |
|
|
|
if timezone.now().date() >= self.start_date.date(): |
|
|
|
return True |
|
|
|
return self.has_team_registrations() |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def has_team_registrations(self): |
|
|
|
|
|
|
|
return len(self.teamregistration_set.all()) > 0 |
|
|
|
|
|
|
|
|
|
|
|
def display_summons(self): |
|
|
|
def display_summons(self): |
|
|
|
if self.end_date is not None: |
|
|
|
if self.end_date is not None: |
|
|
|
return False |
|
|
|
return False |
|
|
|
if self.publish_summons: |
|
|
|
if self.publish_summons: |
|
|
|
return True |
|
|
|
return self.has_summons() |
|
|
|
if timezone.now() >= self.start_date: |
|
|
|
if timezone.now() >= self.start_date: |
|
|
|
return True |
|
|
|
return self.has_summons() |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
def display_group_stages(self): |
|
|
|
def display_group_stages(self): |
|
|
|
@ -651,8 +658,8 @@ class Tournament(models.Model): |
|
|
|
def hide_weight(self): |
|
|
|
def hide_weight(self): |
|
|
|
return self.federal_level_category == FederalLevelCategory.UNLISTED |
|
|
|
return self.federal_level_category == FederalLevelCategory.UNLISTED |
|
|
|
|
|
|
|
|
|
|
|
def is_build_and_not_empty(self): |
|
|
|
# def is_build_and_not_empty(self): |
|
|
|
return (len(self.groupstage_set.all()) > 0 or len(self.round_set.all()) > 0) and len(self.teamregistration_set.all()) >= 4 |
|
|
|
# return (len(self.groupstage_set.all()) > 0 or len(self.round_set.all()) > 0) and len(self.teamregistration_set.all()) >= 4 |
|
|
|
|
|
|
|
|
|
|
|
def day_duration_formatted(self): |
|
|
|
def day_duration_formatted(self): |
|
|
|
return plural_format("jour", self.day_duration) |
|
|
|
return plural_format("jour", self.day_duration) |
|
|
|
|