From 45f64ad058276f7c28a23363a11d134fce563c9f Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Sat, 9 Jul 2016 11:55:52 -0600 Subject: [PATCH] Shorten 'shift period' to four hours. --- bikeshop_project/registration/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bikeshop_project/registration/views.py b/bikeshop_project/registration/views.py index e27bfb1..2a67fe3 100644 --- a/bikeshop_project/registration/views.py +++ b/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)