Browse Source

Shorten 'shift period' to four hours.

feature/python-error-tracking
Drew Larson 8 years ago
parent
commit
45f64ad058
  1. 8
      bikeshop_project/registration/views.py

8
bikeshop_project/registration/views.py

@ -1,5 +1,6 @@
import json
import logging
from datetime import timedelta
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
@ -96,9 +97,10 @@ class MemberSignIn(View):
return JsonResponse(data=data, safe=False, status=201)
def get(self, request):
start = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0)
end = start.replace(hour=23, minute=59, second=59, microsecond=999999)
visits = Visit.objects.filter(created_at__lte=end, created_at__gte=start).prefetch_related()
start = timezone.now()
end = start + timedelta(hours=4)
visits = Visit.objects.filter(created_at__lte=end,
created_at__gte=start).prefetch_related()
serializer = VisitSerializer(visits, many=True)
json = JSONRenderer().render(serializer.data)

Loading…
Cancel
Save