|
|
|
|
@ -35,13 +35,27 @@ class Round(models.Model): |
|
|
|
|
|
|
|
|
|
child_matches = child.match_set.all() |
|
|
|
|
if hide_empty_matches: |
|
|
|
|
child_matches = [m for m in matches if m.should_appear()] |
|
|
|
|
child_matches = [m for m in child_matches if m.should_appear()] |
|
|
|
|
|
|
|
|
|
matches.extend(child_matches) |
|
|
|
|
matches.extend(child.ranking_matches(hide_empty_matches)) |
|
|
|
|
return matches |
|
|
|
|
|
|
|
|
|
def all_matches(self): |
|
|
|
|
matches = list(self.match_set.all()) |
|
|
|
|
matches.extend(self.ranking_matches(True)) |
|
|
|
|
matches = [] |
|
|
|
|
matches.extend(self.match_set.all()) |
|
|
|
|
matches.extend(self.get_matches_recursive(False)) |
|
|
|
|
return matches |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
for child_round in self.children.all(): |
|
|
|
|
matches.extend(child_round.get_matches_recursive(hide_empty_matches)) |
|
|
|
|
|
|
|
|
|
# print(f"{self.name()} > COUNT REC = {len(matches)}") |
|
|
|
|
|
|
|
|
|
return matches |
|
|
|
|
|