fix disabled stuff

clubs
Razmig Sarkissian 1 year ago
parent 92171532f2
commit e5d6253fad
  1. 2
      tournaments/models/match.py
  2. 2
      tournaments/models/round.py
  3. 3
      tournaments/models/tournament.py

@ -114,7 +114,7 @@ class Match(models.Model):
return False
def should_appear(self):
if self.disabled:
if self.disabled is True:
return False
elif self.group_stage is None:
return (self.start_date or self.end_date) and len(self.team_scores.all()) > 0

@ -35,7 +35,6 @@ class Round(models.Model):
for child in self.children.all():
child_matches = child.match_set.all()
if hide_empty_matches:
child_matches = [m for m in child_matches if m.should_appear()]
matches.extend(child_matches)
@ -50,7 +49,6 @@ class Round(models.Model):
def get_matches_recursive(self, hide_empty_matches):
matches = list(self.match_set.all()) # Retrieve matches associated with the current round
if hide_empty_matches:
matches = [m for m in matches if m.should_appear()]
# Recursively fetch matches from child rounds

@ -257,7 +257,6 @@ class Tournament(models.Model):
def group_stage_match_group(self, group_stage, broadcasted, hide_empty_matches):
matches = group_stage.match_set.all()
if hide_empty_matches:
matches = [m for m in matches if m.should_appear()]
if matches:
@ -269,7 +268,6 @@ class Tournament(models.Model):
groups = []
matches = round.match_set.order_by('index').all()
if hide_empty_matches:
matches = [m for m in matches if m.should_appear()]
if matches:
@ -355,7 +353,6 @@ class Tournament(models.Model):
for group_stage in self.groupstage_set.all():
matches.extend(group_stage.match_set.all())
if hide_empty_matches:
matches = [m for m in matches if m.should_appear()]
return matches

Loading…
Cancel
Save