diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 59afd70..55c07ad 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -468,11 +468,14 @@ class Tournament(models.Model): return False def display_tournament(self): - if self.end_date is not None: - return True if self.publish_tournament: return True - if (len(self.groupstage_set.all()) > 0 or len(self.round_set.all()) > 0) and len(self.teamregistration_set.all()) >= 4: + is_build_and_not_empty = self.is_build_and_not_empty() + if self.end_date is not None: + if self.is_canceled is True: + return is_build_and_not_empty + return True + if is_build_and_not_empty is True: if datetime.now().date() >= self.start_date.date(): return True minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) @@ -574,6 +577,9 @@ class Tournament(models.Model): def hide_weight(self): return self.federal_level_category == FederalLevelCategory.UNLISTED + 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 + class MatchGroup: def __init__(self, name, matches): self.name = name