|
|
|
|
@ -77,15 +77,22 @@ def unregister_team(sender, instance, **kwargs): |
|
|
|
|
|
|
|
|
|
notify_team(instance, instance.tournament, TeamEmailType.UNREGISTERED) |
|
|
|
|
teams = instance.tournament.teams(True) |
|
|
|
|
first_waiting_list_team = instance.tournament.first_waiting_list_team(teams) |
|
|
|
|
if first_waiting_list_team and first_waiting_list_team.id != instance.id: |
|
|
|
|
if instance.tournament.automatic_waiting_list(): |
|
|
|
|
waiting_list_teams = instance.tournament.waiting_list_teams(teams) |
|
|
|
|
ttc = None |
|
|
|
|
if waiting_list_teams is not None: |
|
|
|
|
ttc = instance.tournament.calculate_time_to_confirm(len(waiting_list_teams)) |
|
|
|
|
first_waiting_list_team.set_time_to_confirm(ttc) |
|
|
|
|
notify_team(first_waiting_list_team, instance.tournament, TeamEmailType.OUT_OF_WAITING_LIST) |
|
|
|
|
|
|
|
|
|
# Check if the team being deleted is in the waiting list |
|
|
|
|
team_being_deleted = next((team for team in teams if team.team_registration.id == instance.id), None) |
|
|
|
|
is_team_in_waiting_list = team_being_deleted and team_being_deleted.team_registration.out_of_tournament() == True |
|
|
|
|
|
|
|
|
|
# Only notify the first waiting list team if the deleted team is NOT in the waiting list |
|
|
|
|
if not is_team_in_waiting_list: |
|
|
|
|
first_waiting_list_team = instance.tournament.first_waiting_list_team(teams) |
|
|
|
|
if first_waiting_list_team and first_waiting_list_team.id != instance.id: |
|
|
|
|
if instance.tournament.automatic_waiting_list(): |
|
|
|
|
waiting_list_teams = instance.tournament.waiting_list_teams(teams) |
|
|
|
|
ttc = None |
|
|
|
|
if waiting_list_teams is not None: |
|
|
|
|
ttc = instance.tournament.calculate_time_to_confirm(len(waiting_list_teams)) |
|
|
|
|
first_waiting_list_team.set_time_to_confirm(ttc) |
|
|
|
|
notify_team(first_waiting_list_team, instance.tournament, TeamEmailType.OUT_OF_WAITING_LIST) |
|
|
|
|
|
|
|
|
|
@receiver(post_save, sender=Tournament) |
|
|
|
|
def notify_players_of_tournament_cancellation(sender, instance, **kwargs): |
|
|
|
|
|