fix loading tournaments

shop
Razmig Sarkissian 8 months ago
parent e1eca7f232
commit d26d57e782
  1. 15
      tournaments/views.py

@ -155,13 +155,20 @@ def future_tournaments(club_id):
def index_new(request): def index_new(request):
now = timezone.now()
thirty_days_ago = now - timedelta(days=30)
thirty_days_future = now + timedelta(days=30)
club_id = request.GET.get('club') club_id = request.GET.get('club')
tournaments = tournaments_query_new(Q(end_date__isnull=True), club_id, True, None) tournaments = tournaments_query_new(Q(end_date__isnull=True, start_date__gte=thirty_days_ago, start_date__lte=thirty_days_future), club_id, True, None)
display_tournament = [t for t in tournaments if t.display_tournament()] display_tournament = [t for t in tournaments if t.display_tournament()]
live = [t for t in display_tournament if t.supposedly_in_progress()] live = []
future = [t for t in display_tournament if t.starts_in_the_future()] future = []
for t in display_tournament:
if t.supposedly_in_progress():
live.append(t)
elif t.starts_in_the_future():
future.append(t)
clean_ended_tournaments = tournaments_query_new(Q(end_date__isnull=False), club_id, False, 50) clean_ended_tournaments = tournaments_query_new(Q(end_date__isnull=False), club_id, False, 50)
clean_ended_tournaments = [t for t in clean_ended_tournaments if t.display_tournament()] clean_ended_tournaments = [t for t in clean_ended_tournaments if t.display_tournament()]
ended_tournaments = [t for t in display_tournament if t.should_be_over()] ended_tournaments = [t for t in display_tournament if t.should_be_over()]

Loading…
Cancel
Save