add a confirm if place signal on team reg

timetoconfirm
Raz 7 months ago
parent e011d7bd5a
commit 142f0929c2
  1. 4
      tournaments/models/tournament.py
  2. 6
      tournaments/services/email_service.py
  3. 3
      tournaments/services/tournament_registration.py

@ -1220,6 +1220,10 @@ class Tournament(BaseModel):
if self.team_count_limit is False: if self.team_count_limit is False:
return -1 return -1
self.reserved_spots = max(0, self.reserved_spots - 1)
self.reserved_spots += 1
self.save()
# Get count of active teams (not walked out) # Get count of active teams (not walked out)
current_team_count = self.team_registrations.exclude(walk_out=True).count() + self.reserved_spots current_team_count = self.team_registrations.exclude(walk_out=True).count() + self.reserved_spots

@ -331,8 +331,12 @@ class TournamentEmailService:
def _build_out_of_walkout_waiting_list_email_body(tournament, captain, tournament_details_str, other_player): def _build_out_of_walkout_waiting_list_email_body(tournament, captain, tournament_details_str, other_player):
body_parts = [ body_parts = [
"Bonjour,\n\n", "Bonjour,\n\n",
f"Le juge-arbitre vous a ré-intégré au tournoi en liste d'attente {tournament_details_str}, prévu le {tournament.formatted_start_date()} au club {tournament.event.club.name}"
] ]
if captain.registration_status == RegistrationStatus.CANCELED:
body_parts.append("\n\nLe temps accordé pour confirmer votre inscription s'est écoulé.")
body_parts.append(f"Vous avez été replacé en liste d'attente du tournoi {tournament_details_str}, prévu le {tournament.formatted_start_date()} au club {tournament.event.club.name}")
else:
body_parts.append(f"Le juge-arbitre vous a placé en liste d'attente du tournoi {tournament_details_str}, prévu le {tournament.formatted_start_date()} au club {tournament.event.club.name}")
absolute_url = f"https://padelclub.app/tournament/{tournament.id}/info" absolute_url = f"https://padelclub.app/tournament/{tournament.id}/info"
link_text = "informations sur le tournoi" link_text = "informations sur le tournoi"

@ -70,10 +70,7 @@ class RegistrationCartManager:
return False, "Tournoi introuvable." return False, "Tournoi introuvable."
# Update tournament reserved spots # Update tournament reserved spots
tournament.reserved_spots = max(0, tournament.reserved_spots - 1)
waiting_list_position = tournament.get_waiting_list_position() waiting_list_position = tournament.get_waiting_list_position()
tournament.reserved_spots += 1
tournament.save()
# Set up the new cart # Set up the new cart
self.session['registration_cart_id'] = str(uuid.uuid4()) # Ensure it's a string self.session['registration_cart_id'] = str(uuid.uuid4()) # Ensure it's a string

Loading…
Cancel
Save