online_registration
Raz 11 months ago
parent e6526cbb8f
commit b33876b1db
  1. 19
      tournaments/models/tournament.py
  2. 2
      tournaments/templates/tournaments/tournament_info.html

@ -300,14 +300,21 @@ class Tournament(models.Model):
def get_team_waiting_list_position(self, team_registration):
# Use the teams method to get sorted list of teams
all_teams = self.teams(True)
waiting_teams = [t for t in all_teams if t.stage == "Attente"]
# Find matching team in waiting list and return its index
for i, team in enumerate(waiting_teams):
index = -1
# Find position of team in all teams list
for i, team in enumerate(all_teams):
if team.team_registration.id == team_registration.id:
return i
index = i
return -1 # Team not found in waiting list
# Check if target_team_count exists
if self.target_team_count:
# Team is not in list
if index < self.target_team_count:
return -1
# Return position in waiting list relative to target count
return index - self.target_team_count
else:
return -1
def teams(self, includeWaitingList):
# print("Starting teams method")

@ -154,7 +154,7 @@
class="rounded-button destructive-button"
onclick="return confirm('Êtes-vous sûr de vouloir vous désinscrire ?');">
{% if team.is_in_waiting_list >= 0 %}
Se retirer de la liste d'attente
Se retirer de la liste d'attente {{ team.is_in_waiting_list }}
{% else %}
Se désinscrire
{% endif %}

Loading…
Cancel
Save