diff --git a/tournaments/templates/tournaments/live_matches.html b/tournaments/templates/tournaments/live_matches.html
new file mode 100644
index 0000000..19c752f
--- /dev/null
+++ b/tournaments/templates/tournaments/live_matches.html
@@ -0,0 +1,26 @@
+{% extends 'tournaments/base.html' %}
+
+{% block head_title %}Matchs du {{ tournament.display_name }}{% endblock %}
+{% block first_title %}{{ tournament.event.display_name }}{% endblock %}
+{% block second_title %}{{ tournament.display_name }}{% endblock %}
+{% block title_link %}{% url 'tournament' tournament.id %}{% endblock %}
+
+{% block content %}
+
+{% include 'tournaments/navigation_tournament.html' %}
+
+{% if live_matches %}
+
+
En cours
+
+
+ {% for match in live_matches %}
+ {% include 'tournaments/match_cell.html' %}
+ {% endfor %}
+
+{% else %}
+
+
Aucun match en cours actuellement.
+
+{% endif %}
+{% endblock %}
diff --git a/tournaments/templates/tournaments/navigation_tournament.html b/tournaments/templates/tournaments/navigation_tournament.html
index 4af9993..12e173f 100644
--- a/tournaments/templates/tournaments/navigation_tournament.html
+++ b/tournaments/templates/tournaments/navigation_tournament.html
@@ -4,6 +4,10 @@
Informations
+ {% if tournament.supposedly_in_progress %}
+ Live
+ {% endif %}
+
{% if tournament.display_prog %}
Programmation
{% endif %}
diff --git a/tournaments/urls.py b/tournaments/urls.py
index 7b400c3..255845a 100644
--- a/tournaments/urls.py
+++ b/tournaments/urls.py
@@ -45,6 +45,7 @@ urlpatterns = [
path('rankings/json/', views.tournament_rankings_json, name='tournament-rankings-json'),
path('broadcast/rankings/', views.tournament_broadcast_rankings, name='broadcasted-rankings'),
path('team//', views.team_details, name='team-details'),
+ path('live/', views.tournament_live_matches, name='tournament-live'),
])
),
path("event//", views.event, name='event'),
diff --git a/tournaments/views.py b/tournaments/views.py
index cb08308..c1f7cf4 100644
--- a/tournaments/views.py
+++ b/tournaments/views.py
@@ -1782,6 +1782,27 @@ def private_tournaments(request):
}
)
+def tournament_live_matches(request, tournament_id):
+ tournament = get_object_or_404(Tournament, pk=tournament_id)
+ # Get all matches from the tournament
+ current_time = timezone.now()
+ matches = Match.objects.filter(
+ Q(round__tournament=tournament) | Q(group_stage__tournament=tournament),
+ start_date__isnull=False, # Match has a start date
+ start_date__lte=current_time,
+ confirmed=True, # Match is confirmed
+ end_date__isnull=True # Match hasn't ended yet
+ ).order_by('start_date')
+
+ # Convert to live match format
+ live_matches = [match.live_match() for match in matches]
+
+ return render(request, 'tournaments/live_matches.html', {
+ 'tournament': tournament,
+ 'live_matches': live_matches,
+ })
+
+
class UserListExportView(LoginRequiredMixin, View):
def get(self, request, *args, **kwargs):
users = CustomUser.objects.order_by('date_joined')