diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index d26639d..7192dbf 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -37,7 +37,7 @@ class TeamRegistration(models.Model): return "no players" def next_match(self): - all_matches = map(lambda ts: ts.match, self.teamscore_set.all()) + all_matches = [ts.match for ts in self.teamscore_set.all()] all_matches = sorted(all_matches, key=lambda m: m.start_date) matches = [m for m in all_matches if m.end_date is None] if matches: diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index eba470b..a098a92 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -54,18 +54,18 @@ class Tournament(models.Model): return self.start_date.strftime("%d/%m/%y") def team_summons(self): - summons = [] for team_registration in self.teamregistration_set.all(): - next_match = team_registration.next_match() - if next_match: + match = None + match = team_registration.next_match() + if match: names = team_registration.team_names() - stage = next_match.stage_name() + stage = match.stage_name() weight = team_registration.weight() - summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo) + summon = TeamSummon(names, match.start_date, weight, stage, team_registration.logo) summons.append(summon) - summons.sort(key=lambda s: s.weight) + summons.sort(key=lambda s: s.weight) return summons def live_matches(self, broadcasted):