Fix for ticket #4 (charts)

This commit is contained in:
2016-02-07 12:20:39 +01:00
parent 59b0e742d0
commit de0b82d575

View File

@@ -30,7 +30,7 @@ from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, InvalidPage, EmptyPage, PageNotAnInteger
from django.utils import timezone
from django.utils.text import slugify
from django.db.models import Sum
from django.db.models import Sum, Max
from django.conf import settings
from os.path import join as pjoin
from tipp.models import *
@@ -414,7 +414,6 @@ def charts(request, ls, season, pos='default', template_name='charts.html'):
'pos': pos
})
@login_required
def blogindex(request, page):
# get the blog posts that are published
@@ -496,7 +495,13 @@ def logout(request):
def get_current_md(ls,season):
""" get current matchday """
current_md = Match.objects.filter(leagueShortcut=ls, season=season, finished=False).order_by('matchday').values_list('matchday', flat=True).distinct()[0]
try:
current_md = Match.objects.filter(leagueShortcut=ls, season=season, \
finished=False).order_by('matchday').values_list('matchday', \
flat=True).distinct()[0]
except IndexError:
current_md = Match.objects.filter(leagueShortcut=ls, season=season).aggregate(Max('matchday'))
return(current_md)
def get_current_ls():