sort round matches by index

clubs
Laurent 1 year ago
parent c32abf7da8
commit ff7e5f3ff1
  1. 5
      tournaments/models/round.py

@ -44,7 +44,6 @@ class Round(models.Model):
else: else:
child_matches = [m for m in child_matches if m.disabled is False] child_matches = [m for m in child_matches if m.disabled is False]
matches.extend(child_matches) matches.extend(child_matches)
matches.extend(child.ranking_matches(hide_empty_matches)) matches.extend(child.ranking_matches(hide_empty_matches))
return matches return matches
@ -62,12 +61,12 @@ class Round(models.Model):
else: else:
matches = [m for m in matches if m.disabled is False] matches = [m for m in matches if m.disabled is False]
matches.sort(key=lambda m: m.index)
# Recursively fetch matches from child rounds # Recursively fetch matches from child rounds
for child_round in self.children.all(): for child_round in self.children.all():
matches.extend(child_round.get_matches_recursive(hide_empty_matches)) matches.extend(child_round.get_matches_recursive(hide_empty_matches))
# print(f"{self.name()} > COUNT REC = {len(matches)}")
return matches return matches
def root_round(self): def root_round(self):

Loading…
Cancel
Save