Laurent 2 months ago
commit 0af9609075
  1. 1
      tournaments/models/enums.py
  2. 9
      tournaments/models/player_registration.py
  3. 17
      tournaments/models/tournament.py
  4. 17
      tournaments/services/email_service.py
  5. 49
      tournaments/templates/tournaments/navigation_tournament.html
  6. 5
      tournaments/views.py

@ -340,3 +340,4 @@ class AnimationType(models.IntegerChoices):
MELEE = 1, 'Mêlée'
LOSER_BRACKET = 2, 'Classement'
CONSOLATION_BRACKET = 3, 'Consolation'
CUSTOM = 4, 'Custom'

@ -135,10 +135,15 @@ class PlayerRegistration(TournamentSubModel):
tournament = self.team_registration.tournament
tournament_status_team_count = tournament.get_tournament_status_team_count()
# If custom animation type, replace header by "Inscriptions"
if tournament.is_custom_animation():
header = "Inscriptions"
else:
header = "Équipes"
if tournament.is_canceled():
return {
'header': "Équipes",
'header': header,
'position': tournament_status_team_count,
'display_box': True,
'box_class': 'light-red',
@ -146,7 +151,7 @@ class PlayerRegistration(TournamentSubModel):
}
status = {
'header': "Équipes",
'header': header,
'position': tournament_status_team_count,
'display_box': True,
'box_class': 'gray',

@ -210,9 +210,24 @@ class Tournament(BaseModel):
def level(self):
return self.get_federal_level_category_display()
def is_custom_animation(self):
return self.animation_type == AnimationType.CUSTOM
def short_level(self):
if self.federal_level_category == 0:
return "Anim."
match self.animation_type:
case AnimationType.TOURNAMENT:
return "Anim."
case AnimationType.MELEE:
return "Mêlée"
case AnimationType.LOSER_BRACKET:
return "Classement"
case AnimationType.CONSOLATION_BRACKET:
return "Consolante"
case AnimationType.CUSTOM:
return "Spécial"
case _:
return "Anim."
if self.federal_level_category == 1:
return "CHPT"
return self.get_federal_level_category_display()

@ -113,11 +113,18 @@ class TournamentEmailService:
link_text = f"informations sur {tournament_prefix_that}{tournament_word}"
absolute_url = f'<a href="{absolute_url}">{link_text}</a>'
body_parts.extend([
f"\nDate d'inscription: {inscription_date}",
f"\nÉquipe inscrite: {captain.name()} et {other_player.name()}",
f"\nVoir les {absolute_url}"
])
if other_player:
body_parts.extend([
f"\nDate d'inscription: {inscription_date}",
f"\nÉquipe inscrite: {captain.name()} et {other_player.name()}",
f"\nVoir les {absolute_url}"
])
else:
body_parts.extend([
f"\nDate d'inscription: {inscription_date}",
f"\nVotre inscription: {captain.name()}",
f"\nVoir les {absolute_url}"
])
# Add payment information if applicable
if tournament.should_request_payment():

@ -4,36 +4,39 @@
<a href="{% url 'tournament-info' tournament.id %}" class="topmargin5 orange">Informations</a>
{% if tournament.supposedly_in_progress %}
<a href="{% url 'tournament-live' tournament.id %}" class="topmargin5 orange">Live</a>
{% endif %}
{% if not tournament.is_custom_animation %}
{% if tournament.supposedly_in_progress %}
<a href="{% url 'tournament-live' tournament.id %}" class="topmargin5 orange">Live</a>
{% endif %}
{% if tournament.display_prog %}
<a href="{% url 'tournament-prog' tournament.id %}" class="topmargin5 orange">Programmation</a>
{% endif %}
{% if tournament.display_prog %}
<a href="{% url 'tournament-prog' tournament.id %}" class="topmargin5 orange">Programmation</a>
{% endif %}
{% if tournament.display_matches and tournament.has_bracket %}
<a href="{% url 'tournament-bracket' tournament.id %}" class="topmargin5 orange">Tableau</a>
{% endif %}
{% if tournament.display_matches and tournament.has_bracket %}
<a href="{% url 'tournament-bracket' tournament.id %}" class="topmargin5 orange">Tableau</a>
{% endif %}
{% if tournament.display_matches or tournament.display_group_stages %}
<a href="{% url 'tournament' tournament.id %}" class="topmargin5 orange">Matchs</a>
{% endif %}
{% if tournament.display_matches or tournament.display_group_stages %}
<a href="{% url 'tournament' tournament.id %}" class="topmargin5 orange">Matchs</a>
{% endif %}
{% if tournament.display_group_stages %}
<a href="{% url 'group-stages' tournament.id %}" class="topmargin5 orange">Poules</a>
{% endif %}
{% if tournament.display_group_stages %}
<a href="{% url 'group-stages' tournament.id %}" class="topmargin5 orange">Poules</a>
{% endif %}
{% if tournament.display_summons %}
<a href="{% url 'tournament-summons' tournament.id %}" class="topmargin5 orange">Convocations</a>
{% endif %}
{% if tournament.display_summons %}
<a href="{% url 'tournament-summons' tournament.id %}" class="topmargin5 orange">Convocations</a>
{% endif %}
{% if tournament.display_teams %}
<a href="{% url 'tournament-teams' tournament.id %}" class="topmargin5 orange">Équipes</a>
{% endif %}
{% if tournament.display_teams %}
<a href="{% url 'tournament-teams' tournament.id %}" class="topmargin5 orange">Équipes</a>
{% endif %}
{% if tournament.display_rankings %}
<a href="{% url 'tournament-rankings' tournament.id %}" class="topmargin5 orange">Classement</a>
{% endif %}
{% if tournament.display_rankings %}
<a href="{% url 'tournament-rankings' tournament.id %}" class="topmargin5 orange">Classement</a>
{% endif %}
{% if user.is_authenticated %}

@ -65,6 +65,8 @@ from .services.payment_service import PaymentService
import logging
from .models import AnimationType
logger = logging.getLogger(__name__)
def index(request):
@ -119,6 +121,9 @@ def tournaments_query(query, club_id, ascending, limit=None):
club = get_object_or_404(Club, pk=club_id)
q_club = Q(event__club=club)
queries.append(q_club)
else:
q_animation_type = ~Q(animation_type=AnimationType.CUSTOM)
queries.append(q_animation_type)
sortkey = 'start_date'
if not ascending:

Loading…
Cancel
Save