Skip to content

Commit

Permalink
use correct date ranges in hourly analysis query filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
cmplx-xyttmt committed Oct 20, 2023
1 parent f4710e3 commit 85b6ead
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions analysis/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_analysis_queryset(api_view_object: ListAPIView, hourly=True):
else:
queryset = DailyAggregate.objects.filter(device__device_id=device_id)

queryset = queryset.filter(date__range=[today - timedelta(past_days), today])
queryset = queryset.filter(date__range=[datetime.now() - timedelta(days=past_days), datetime.now()])
return queryset.order_by('-date')


Expand All @@ -124,8 +124,9 @@ class DailyAnalysisView(ListAPIView):

def get_queryset(self):
return get_analysis_queryset(self, False)
#
#


# TODO: Change this to receive the daily/nightly metrics from an endpoint.
# class ReceiveIoTDataView(APIView):
#
# def post(self, request):
Expand Down

0 comments on commit 85b6ead

Please sign in to comment.