|
|
|
@ -217,7 +217,17 @@ class Tournament(models.Model): |
|
|
|
wildcard_bracket = [] |
|
|
|
wildcard_bracket = [] |
|
|
|
wildcard_group_stage = [] |
|
|
|
wildcard_group_stage = [] |
|
|
|
complete_teams = [] |
|
|
|
complete_teams = [] |
|
|
|
|
|
|
|
closed_registration_date = self.closed_registration_date |
|
|
|
|
|
|
|
|
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
for team_registration in self.teamregistration_set.all(): |
|
|
|
|
|
|
|
is_valid = False |
|
|
|
|
|
|
|
if closed_registration_date is not None and team_registration.registration_date is not None and team_registration.registration_date <= closed_registration_date: |
|
|
|
|
|
|
|
is_valid = True |
|
|
|
|
|
|
|
if closed_registration_date is None: |
|
|
|
|
|
|
|
is_valid = True |
|
|
|
|
|
|
|
if team_registration.registration_date is None: |
|
|
|
|
|
|
|
is_valid = True |
|
|
|
|
|
|
|
|
|
|
|
if team_registration.walk_out is False: |
|
|
|
if team_registration.walk_out is False: |
|
|
|
names = team_registration.team_names() |
|
|
|
names = team_registration.team_names() |
|
|
|
weight = team_registration.weight |
|
|
|
weight = team_registration.weight |
|
|
|
@ -230,8 +240,11 @@ class Tournament(models.Model): |
|
|
|
wildcard_bracket.append(team) |
|
|
|
wildcard_bracket.append(team) |
|
|
|
elif team_registration.wild_card_group_stage: |
|
|
|
elif team_registration.wild_card_group_stage: |
|
|
|
wildcard_group_stage.append(team) |
|
|
|
wildcard_group_stage.append(team) |
|
|
|
else: |
|
|
|
elif is_valid is True: |
|
|
|
complete_teams.append(team) |
|
|
|
complete_teams.append(team) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
waiting_teams.append(team) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(teams) < self.team_count: |
|
|
|
if len(teams) < self.team_count: |
|
|
|
teams.sort(key=lambda s: (s.initial_weight, s.date)) |
|
|
|
teams.sort(key=lambda s: (s.initial_weight, s.date)) |
|
|
|
@ -266,8 +279,9 @@ class Tournament(models.Model): |
|
|
|
if waiting_list_count < 0: |
|
|
|
if waiting_list_count < 0: |
|
|
|
waiting_list_count = 0 |
|
|
|
waiting_list_count = 0 |
|
|
|
|
|
|
|
|
|
|
|
if waiting_list_count > 0: |
|
|
|
if waiting_list_count > 0 or len(waiting_teams) > 0: |
|
|
|
waiting_teams = complete_teams[-waiting_list_count:] |
|
|
|
if waiting_list_count > 0: |
|
|
|
|
|
|
|
waiting_teams = waiting_teams + complete_teams[-waiting_list_count:] |
|
|
|
if self.team_sorting == TeamSortingType.INSCRIPTION_DATE: |
|
|
|
if self.team_sorting == TeamSortingType.INSCRIPTION_DATE: |
|
|
|
waiting_teams.sort(key=lambda s: (s.date, s.initial_weight)) |
|
|
|
waiting_teams.sort(key=lambda s: (s.date, s.initial_weight)) |
|
|
|
else: |
|
|
|
else: |
|
|
|
|