fix issue with registration email service

bracket-feature
Raz 9 months ago
parent 580c24e916
commit e1e62ea963
  1. 5
      tournaments/services/email_service.py
  2. 29
      tournaments/signals.py

@ -197,7 +197,7 @@ class TournamentEmailService:
]
absolute_url = f"https://padelclub.app/tournament/{tournament.id}/info"
link_text = "informations sur le tournoi"
link_text = "accéder au tournoi"
absolute_url = f'<a href="{absolute_url}">{link_text}</a>'
if other_player is not None:
@ -206,8 +206,9 @@ class TournamentEmailService:
)
body_parts.append(
"\nSi vous n'êtes plus disponible pour participer à ce tournoi, cliquez sur ce lien ou contactez rapidement le juge-arbitre."
"\n\nSi vous n'êtes plus disponible pour participer à ce tournoi, cliquez sur ce lien ou contactez rapidement le juge-arbitre."
f"\n{absolute_url}"
"\nPour vous désinscrire en ligne vous devez avoir un compte Padel Club."
)
body_parts.extend([

@ -12,8 +12,6 @@ import requests
from tournaments.services.email_service import TournamentEmailService
from tournaments.models import PlayerDataSource
tournament_deletion_in_progress = set()
def generate_unique_code():
characters = string.ascii_lowercase + string.digits
while True:
@ -65,6 +63,8 @@ def send_discord_message(webhook_url, content):
def unregister_team(sender, instance, **kwargs):
team_registration = instance
tournament = instance.tournament
if tournament.is_deleted is True:
return
# Create unregistered player records and track captain/other player
captain = None
@ -83,16 +83,8 @@ def unregister_team(sender, instance, **kwargs):
other_player
)
@receiver(post_delete, sender=TeamRegistration)
def handle_waiting_list(sender, instance, **kwargs):
team_registration = instance
tournament = team_registration.tournament
global tournament_deletion_in_progress
print('post_delete TeamRegistration', tournament_deletion_in_progress)
if tournament.id in tournament_deletion_in_progress:
return
first_waiting_list_team = tournament.first_waiting_list_team()
print("first_waiting_list_team", first_waiting_list_team)
# Handle waiting list notifications
if first_waiting_list_team:
@ -111,18 +103,13 @@ def handle_waiting_list(sender, instance, **kwargs):
waiting_other_player
)
@receiver(post_delete, sender=Tournament)
def tournament_deletion(sender, instance, **kwargs):
global tournament_deletion_in_progress
tournament_deletion_in_progress.discard(instance.id)
print('post tournament_deletion_in_progress', tournament_deletion_in_progress)
@receiver(pre_delete, sender=Tournament)
@receiver(post_save, sender=Tournament)
def notify_players_of_tournament_cancellation(sender, instance, **kwargs):
tournament = instance
global tournament_deletion_in_progress
tournament_deletion_in_progress.add(instance.id)
print('pre tournament_deletion_in_progress', tournament_deletion_in_progress)
if tournament.is_deleted is False:
return
# Get all team registrations
team_registrations = tournament.teamregistration_set.all()

Loading…
Cancel
Save