|
|
|
@ -71,11 +71,11 @@ class TournamentEmailService: |
|
|
|
return base_subject |
|
|
|
return base_subject |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def send_registration_confirmation(request, tournament, team_registration, waiting_list_position): |
|
|
|
def send_registration_confirmation(request, tournament, team_registration, waiting_list_position, force_send=False): |
|
|
|
if waiting_list_position >= 0: |
|
|
|
if waiting_list_position >= 0: |
|
|
|
TournamentEmailService.notify_team(team_registration, tournament, TeamEmailType.WAITING_LIST) |
|
|
|
TournamentEmailService.notify_team(team_registration, tournament, TeamEmailType.WAITING_LIST, force_send) |
|
|
|
else: |
|
|
|
else: |
|
|
|
TournamentEmailService.notify_team(team_registration, tournament, TeamEmailType.REGISTERED) |
|
|
|
TournamentEmailService.notify_team(team_registration, tournament, TeamEmailType.REGISTERED, force_send) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def _build_registration_confirmation_email_body(tournament, captain, tournament_details_str, other_player): |
|
|
|
def _build_registration_confirmation_email_body(tournament, captain, tournament_details_str, other_player): |
|
|
|
@ -515,9 +515,9 @@ class TournamentEmailService: |
|
|
|
return f"\n\n{warning_text}{action_text}{account_info}" |
|
|
|
return f"\n\n{warning_text}{action_text}{account_info}" |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def notify(captain, other_player, tournament, message_type: TeamEmailType): |
|
|
|
def notify(captain, other_player, tournament, message_type: TeamEmailType, force_send=False): |
|
|
|
print("TournamentEmailService.notify", captain.player_contact(), captain.registered_online, tournament, message_type) |
|
|
|
print("TournamentEmailService.notify", captain.player_contact(), captain.registered_online, tournament, message_type) |
|
|
|
if not captain or not captain.registered_online or not captain.player_contact(): |
|
|
|
if not captain or (not captain.registered_online and not force_send) or not captain.player_contact(): |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
tournament_details_str = tournament.build_tournament_details_str() |
|
|
|
tournament_details_str = tournament.build_tournament_details_str() |
|
|
|
@ -600,19 +600,19 @@ class TournamentEmailService: |
|
|
|
# print"TournamentEmailService._send_email", to, subject) |
|
|
|
# print"TournamentEmailService._send_email", to, subject) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def notify_team(team, tournament, message_type: TeamEmailType): |
|
|
|
def notify_team(team, tournament, message_type: TeamEmailType, force_send=False): |
|
|
|
# Notify both players separately if there is no captain or the captain is unavailable |
|
|
|
# Notify both players separately if there is no captain or the captain is unavailable |
|
|
|
players = list(team.players_sorted_by_captain) |
|
|
|
players = list(team.players_sorted_by_captain) |
|
|
|
if len(players) == 2: |
|
|
|
if len(players) == 2: |
|
|
|
# print"TournamentEmailService.notify_team 2p", team) |
|
|
|
# print"TournamentEmailService.notify_team 2p", team) |
|
|
|
first_player, second_player = players |
|
|
|
first_player, second_player = players |
|
|
|
TournamentEmailService.notify(first_player, second_player, tournament, message_type) |
|
|
|
TournamentEmailService.notify(first_player, second_player, tournament, message_type, force_send) |
|
|
|
if first_player.player_contact() != second_player.player_contact(): |
|
|
|
if first_player.player_contact() != second_player.player_contact(): |
|
|
|
TournamentEmailService.notify(second_player, first_player, tournament, message_type) |
|
|
|
TournamentEmailService.notify(second_player, first_player, tournament, message_type, force_send) |
|
|
|
elif len(players) == 1: |
|
|
|
elif len(players) == 1: |
|
|
|
# print"TournamentEmailService.notify_team 1p", team) |
|
|
|
# print"TournamentEmailService.notify_team 1p", team) |
|
|
|
# If there's only one player, just send them the notification |
|
|
|
# If there's only one player, just send them the notification |
|
|
|
TournamentEmailService.notify(players[0], None, tournament, message_type) |
|
|
|
TournamentEmailService.notify(players[0], None, tournament, message_type, force_send) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def notify_umpire(team, tournament, message_type): |
|
|
|
def notify_umpire(team, tournament, message_type): |
|
|
|
|