|
|
|
@ -184,7 +184,7 @@ class Match(SideStoreModel): |
|
|
|
def is_ready(self): |
|
|
|
def is_ready(self): |
|
|
|
return self.team_scores.count() == 2 |
|
|
|
return self.team_scores.count() == 2 |
|
|
|
|
|
|
|
|
|
|
|
def live_teams(self, hide_names=False): |
|
|
|
def live_teams(self, hide_names=False, short_names=False): |
|
|
|
#print('player names from match') |
|
|
|
#print('player names from match') |
|
|
|
##return map(lambda ts: ts.player_names(), self.team_scores.all()) |
|
|
|
##return map(lambda ts: ts.player_names(), self.team_scores.all()) |
|
|
|
# List to hold the names of the teams |
|
|
|
# List to hold the names of the teams |
|
|
|
@ -247,7 +247,7 @@ class Match(SideStoreModel): |
|
|
|
teams.append(team) |
|
|
|
teams.append(team) |
|
|
|
elif len(team_scores) == 1: |
|
|
|
elif len(team_scores) == 1: |
|
|
|
# Only one team score, handle missing one |
|
|
|
# Only one team score, handle missing one |
|
|
|
existing_team = team_scores[0].live_team(self) |
|
|
|
existing_team = team_scores[0].live_team(self, short_names=short_names) |
|
|
|
if (self.group_stage): |
|
|
|
if (self.group_stage): |
|
|
|
teams.append(existing_team) |
|
|
|
teams.append(existing_team) |
|
|
|
names = ["Équipe de poule"] |
|
|
|
names = ["Équipe de poule"] |
|
|
|
@ -287,19 +287,19 @@ class Match(SideStoreModel): |
|
|
|
|
|
|
|
|
|
|
|
elif len(team_scores) == 2: |
|
|
|
elif len(team_scores) == 2: |
|
|
|
# Both team scores present |
|
|
|
# Both team scores present |
|
|
|
teams.extend([team_score.live_team(self) for team_score in team_scores]) |
|
|
|
teams.extend([team_score.live_team(self, short_names=short_names) for team_score in team_scores]) |
|
|
|
|
|
|
|
|
|
|
|
if self.round is not None and self.round.parent is None: |
|
|
|
if self.round is not None and self.round.parent is None: |
|
|
|
pos1 = team_scores[0].team_registration.bracket_position if hasattr(team_scores[0], 'team_registration') and team_scores[0].team_registration else None |
|
|
|
pos1 = team_scores[0].team_registration.bracket_position if hasattr(team_scores[0], 'team_registration') and team_scores[0].team_registration else None |
|
|
|
pos2 = team_scores[1].team_registration.bracket_position if hasattr(team_scores[1], 'team_registration') and team_scores[1].team_registration else None |
|
|
|
pos2 = team_scores[1].team_registration.bracket_position if hasattr(team_scores[1], 'team_registration') and team_scores[1].team_registration else None |
|
|
|
if pos1 is not None and pos2 is not None and pos1 // 2 == self.index and pos2 // 2 == self.index: |
|
|
|
if pos1 is not None and pos2 is not None and pos1 // 2 == self.index and pos2 // 2 == self.index: |
|
|
|
if pos1 > pos2: |
|
|
|
if pos1 > pos2: |
|
|
|
teams = [team_scores[1].live_team(self), team_scores[0].live_team(self)] |
|
|
|
teams = [team_scores[1].live_team(self, short_names=short_names), team_scores[0].live_team(self, short_names=short_names)] |
|
|
|
else: |
|
|
|
else: |
|
|
|
teams = [team_scores[0].live_team(self), team_scores[1].live_team(self)] |
|
|
|
teams = [team_scores[0].live_team(self, short_names=short_names), team_scores[1].live_team(self, short_names=short_names)] |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
teams.extend([team_score.live_team(self) for team_score in team_scores if team_score.walk_out != 1]) |
|
|
|
teams.extend([team_score.live_team(self, short_names=short_names) for team_score in team_scores if team_score.walk_out != 1]) |
|
|
|
|
|
|
|
|
|
|
|
return teams |
|
|
|
return teams |
|
|
|
|
|
|
|
|
|
|
|
@ -426,7 +426,7 @@ class Match(SideStoreModel): |
|
|
|
else: |
|
|
|
else: |
|
|
|
return self.round.tournament.short_full_name() |
|
|
|
return self.round.tournament.short_full_name() |
|
|
|
|
|
|
|
|
|
|
|
def live_match(self, hide_teams=False, event_mode=False): |
|
|
|
def live_match(self, hide_teams=False, event_mode=False, short_names=False): |
|
|
|
title = self.computed_name() |
|
|
|
title = self.computed_name() |
|
|
|
date = self.formatted_start_date() |
|
|
|
date = self.formatted_start_date() |
|
|
|
time_indication = self.time_indication() |
|
|
|
time_indication = self.time_indication() |
|
|
|
@ -447,7 +447,7 @@ class Match(SideStoreModel): |
|
|
|
|
|
|
|
|
|
|
|
livematch = LiveMatch(self.index, title, date, time_indication, court, self.started(), ended, group_stage_name, live_format, self.start_date, self.court_index, self.disabled, bracket_name, self.should_show_lucky_loser_status(), tournament_title) |
|
|
|
livematch = LiveMatch(self.index, title, date, time_indication, court, self.started(), ended, group_stage_name, live_format, self.start_date, self.court_index, self.disabled, bracket_name, self.should_show_lucky_loser_status(), tournament_title) |
|
|
|
|
|
|
|
|
|
|
|
for team in self.live_teams(hide_teams): |
|
|
|
for team in self.live_teams(hide_teams, short_names): |
|
|
|
livematch.add_team(team) |
|
|
|
livematch.add_team(team) |
|
|
|
|
|
|
|
|
|
|
|
return livematch |
|
|
|
return livematch |
|
|
|
|