hide empty tournaments when running

tz
Raz 1 year ago
parent 2878dde82e
commit fb1494e742
  1. 12
      tournaments/models/tournament.py

@ -679,11 +679,13 @@ class Tournament(models.Model):
def display_tournament(self):
if self.publish_tournament:
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:
return True
return is_build_and_not_empty
if datetime.now().date() >= self.start_date.date():
return True
return is_build_and_not_empty
minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1)
return timezone.now() >= minimum_publish_date
@ -784,8 +786,8 @@ class Tournament(models.Model):
def hide_weight(self):
return self.hide_teams_weight
# 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
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
def day_duration_formatted(self):
return plural_format("jour", self.day_duration)

Loading…
Cancel
Save