|
|
|
|
@ -606,6 +606,49 @@ class TournamentEmailService: |
|
|
|
|
# If there's only one player, just send them the notification |
|
|
|
|
TournamentEmailService.notify(players[0], None, tournament, message_type) |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def notify_umpire(team, tournament, message_type): |
|
|
|
|
# Notify the umpire if needed |
|
|
|
|
umpire_email = tournament.umpire_mail() |
|
|
|
|
if umpire_email: |
|
|
|
|
tournament_details_str = tournament.build_tournament_details_str() |
|
|
|
|
|
|
|
|
|
federal_level_category = FederalLevelCategory(tournament.federal_level_category) |
|
|
|
|
tournament_word = federal_level_category.localized_word() |
|
|
|
|
tournament_prefix_that = federal_level_category.localized_prefix_that() |
|
|
|
|
|
|
|
|
|
body_parts = [ |
|
|
|
|
"Email automatique suite à une désinscription", |
|
|
|
|
f"\n\n{tournament_details_str} | {tournament.formatted_start_date()} | {tournament.event.club.name}" |
|
|
|
|
"\n\nL'équipe ci-dessous a annulé son inscription via le site PadelClub :", |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
for player in team.players_sorted_by_rank: |
|
|
|
|
body_parts.append( |
|
|
|
|
f"\n{player.name()}" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
absolute_url = f"https://padelclub.app/tournament/{tournament.id}/info" |
|
|
|
|
link_text = f"informations sur {tournament_prefix_that}{tournament_word} sur https://padelclub.app" |
|
|
|
|
absolute_url = f'<a href="{absolute_url}">{link_text}</a>' |
|
|
|
|
|
|
|
|
|
body_parts.append( |
|
|
|
|
f"\n\nVoir les {absolute_url}", |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
body_parts.extend([ |
|
|
|
|
"\n\nCeci est un e-mail automatique." |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
email_body = "".join(body_parts) |
|
|
|
|
|
|
|
|
|
if email_body is None: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
topic = message_type.email_topic(tournament.federal_level_category) |
|
|
|
|
email_subject = TournamentEmailService.email_subject(tournament, topic) |
|
|
|
|
TournamentEmailService._send_email(umpire_email, email_subject, email_body) |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def _build_payment_info(tournament, team_registration): |
|
|
|
|
""" |
|
|
|
|
|