From 14e53396d363b57644f7dbd342e3ecad37362dc7 Mon Sep 17 00:00:00 2001 From: Raz Date: Thu, 3 Oct 2024 16:11:55 +0200 Subject: [PATCH] add club auto broadcast --- tournaments/views.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tournaments/views.py b/tournaments/views.py index 382c01d..0722b9b 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -332,14 +332,14 @@ def club_broadcast_auto(request, broadcast_code): tournaments = Tournament.objects.filter( q_not_deleted, + Q(is_private=False), # Exclude private tournaments ( - Q(end_date__isnull=True) | # Include ongoing tournaments - Q(start_date__lt=now + timedelta(days=3)) # Include tournaments starting in the next 3 days - ), - Q(is_private=False) # Exclude private tournaments - ).filter( - Q(end_date__gte=recent_time_window) | # Include tournaments that just finished in the last 4 hours - Q(end_date__isnull=True) # Ensure ongoing tournaments are included + ( + Q(end_date__isnull=True) & # Include ongoing tournaments + (Q(start_date__gte=now - timedelta(days=3)) & Q(start_date__lt=now + timedelta(days=3))) # Include tournaments that are ongoing and start within 3 days + ) | + (Q(end_date__isnull=False) & Q(end_date__gte=recent_time_window)) # Include tournaments finished within the last 4 hours + ) ) tournament_ids = [str(tournament.id) for tournament in tournaments]