|
|
|
|
@ -113,21 +113,16 @@ def check_waiting_list(sender, instance, **kwargs): |
|
|
|
|
|
|
|
|
|
teams_out_to_warn = [] |
|
|
|
|
teams_in_to_warn = [] |
|
|
|
|
previous_state_teams = previous_state.teams(True) |
|
|
|
|
|
|
|
|
|
if previous_state.team_count > instance.team_count: |
|
|
|
|
teams_to_remove_count = previous_state.team_count - instance.team_count |
|
|
|
|
sorted_teams = sorted( |
|
|
|
|
[team for team in previous_state_teams if team.stage != "Attente" and not (team.wildcard_bracket or team.wildcard_groupstage)], |
|
|
|
|
key=lambda t: ( |
|
|
|
|
t.registration_date is None, t.registration_date or datetime.min, t.initial_weight, t.team_registration.id |
|
|
|
|
) if previous_state.team_sorting == TeamSortingType.INSCRIPTION_DATE else |
|
|
|
|
(t.initial_weight, t.team_registration.id) |
|
|
|
|
) |
|
|
|
|
teams_out_to_warn = sorted_teams[-teams_to_remove_count:] |
|
|
|
|
teams_that_will_be_out = instance.teams(True)[instance.team_count:] |
|
|
|
|
teams_out_to_warn = [ |
|
|
|
|
team for team in teams_that_will_be_out |
|
|
|
|
if team.stage != "Attente" |
|
|
|
|
] |
|
|
|
|
elif previous_state.team_count < instance.team_count: |
|
|
|
|
teams_that_will_be_in = previous_state.teams(True)[previous_state.team_count:instance.team_count] |
|
|
|
|
teams_in_to_warn = [ |
|
|
|
|
team for team in previous_state_teams[(instance.team_count - previous_state.team_count):] |
|
|
|
|
team for team in teams_that_will_be_in |
|
|
|
|
if team.stage == "Attente" |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|