From b1d0f35cf79781bbf00dfc8bcc26bcd14fca59bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Tue, 30 Jun 2020 22:35:20 +0200 Subject: [PATCH] Fix first and last sample --- bite/telemetry/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bite/telemetry/views.py b/bite/telemetry/views.py index 9abb7e3..916f7be 100644 --- a/bite/telemetry/views.py +++ b/bite/telemetry/views.py @@ -47,9 +47,9 @@ class TelemetrySummaryView(APIView): if count == 0: raise Http404 first = Telemetry.objects.filter( - device__serial=device).order_by('-time')[:1][0] - last = Telemetry.objects.filter( device__serial=device).order_by('time')[:1][0] + last = Telemetry.objects.filter( + device__serial=device).order_by('-time')[:1][0] data = { 'device': device, 'stats': {