Fix pagination bug in counts

This commit is contained in:
Claudio Maggioni (maggicl) 2019-07-27 11:38:32 +02:00
parent 36fcc8d9c9
commit 5f00a0d480

View file

@ -18,6 +18,7 @@ import json
from django.core.serializers.json import DjangoJSONEncoder
import csv
from django.utils.encoding import smart_str
import math
# https://stackoverflow.com/questions/5882405
def tofirstdayinisoweek(year, week):
@ -122,8 +123,8 @@ def arrow_count_list(request):
counts = ArrowCount.objects.order_by('-date') \
.filter(user = request.user)[start:finish]
pageCount = ArrowCount.objects.filter(user = request.user).count() / \
settings.ITEMS_PER_PAGE
pageCount = math.ceil(ArrowCount.objects.filter(user = request.user).count() / \
settings.ITEMS_PER_PAGE)
template = loader.get_template('counter/list.html')
return HttpResponse(template.render({
'counts': counts,