|
|
|
|
@ -170,7 +170,7 @@ class Tournament(models.Model): |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
def registration_count_display(self): |
|
|
|
|
teams = self.teams() |
|
|
|
|
teams = self.teams(True) |
|
|
|
|
if teams is not None and len(teams) > 0: |
|
|
|
|
return f"{len(teams)} équipes inscrites" |
|
|
|
|
else: |
|
|
|
|
@ -180,7 +180,7 @@ class Tournament(models.Model): |
|
|
|
|
if self.is_canceled() is True: |
|
|
|
|
return "Annulé" |
|
|
|
|
|
|
|
|
|
teams = self.teams() |
|
|
|
|
teams = self.teams(True) |
|
|
|
|
if self.supposedly_in_progress() or self.end_date is not None: |
|
|
|
|
teams = [t for t in teams if t.stage != "Attente"] |
|
|
|
|
if teams is not None and len(teams) > 0: |
|
|
|
|
@ -214,15 +214,23 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
def team_summons(self): |
|
|
|
|
summons = [] |
|
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
|
if team_registration.is_valid_for_summon(): |
|
|
|
|
next_match = team_registration.next_match() |
|
|
|
|
if next_match and next_match.start_date is not None: |
|
|
|
|
names = team_registration.team_names() |
|
|
|
|
stage = next_match.summon_stage_name() |
|
|
|
|
weight = team_registration.weight |
|
|
|
|
summon = TeamSummon(names, next_match.start_date, weight, stage, next_match.court_name(next_match.court_index), team_registration.logo) |
|
|
|
|
summons.append(summon) |
|
|
|
|
if self.supposedly_in_progress() and self.end_date is None: |
|
|
|
|
for team in self.teams(False): |
|
|
|
|
names = team.names |
|
|
|
|
stage = team.stage |
|
|
|
|
weight = team.weight |
|
|
|
|
summon = TeamSummon(names, team.date, weight, stage, "", team.image) |
|
|
|
|
summons.append(summon) |
|
|
|
|
else: |
|
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
|
if team_registration.is_valid_for_summon(): |
|
|
|
|
next_match = team_registration.next_match() |
|
|
|
|
if next_match and next_match.start_date is not None: |
|
|
|
|
names = team_registration.team_names() |
|
|
|
|
stage = next_match.summon_stage_name() |
|
|
|
|
weight = team_registration.weight |
|
|
|
|
summon = TeamSummon(names, next_match.start_date, weight, stage, next_match.court_name(next_match.court_index), team_registration.logo) |
|
|
|
|
summons.append(summon) |
|
|
|
|
|
|
|
|
|
summons.sort(key=lambda s: s.date) |
|
|
|
|
return summons |
|
|
|
|
@ -248,7 +256,7 @@ class Tournament(models.Model): |
|
|
|
|
rankings.sort(key=lambda r: r.ranking) |
|
|
|
|
return rankings |
|
|
|
|
|
|
|
|
|
def teams(self): |
|
|
|
|
def teams(self, includeWaitingList): |
|
|
|
|
print("Starting teams method") |
|
|
|
|
bracket_teams = [] |
|
|
|
|
group_stage_teams = [] |
|
|
|
|
@ -368,8 +376,12 @@ class Tournament(models.Model): |
|
|
|
|
for team in waiting_teams: |
|
|
|
|
team.set_stage("Attente") |
|
|
|
|
|
|
|
|
|
final_teams = bracket_teams + group_stage_teams + waiting_teams |
|
|
|
|
print(f"Final teams: {len(final_teams)}") |
|
|
|
|
if includeWaitingList is True: |
|
|
|
|
final_teams = bracket_teams + group_stage_teams + waiting_teams |
|
|
|
|
print(f"Final teams with waiting list: {len(final_teams)}") |
|
|
|
|
else: |
|
|
|
|
final_teams = bracket_teams + group_stage_teams |
|
|
|
|
print(f"Final teams without waiting list: {len(final_teams)}") |
|
|
|
|
return final_teams |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|