# get return 2 bug fixed
This commit is contained in:
parent
e0e3c46533
commit
3b6ac9ef13
|
@ -61,7 +61,8 @@ class DeviceLogStatisticAPIView(APIView):
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
# calc total count, no cache
|
# calc total count, no cache
|
||||||
total_count_queryset = [DeviceCount.objects.get(device_id=x['device_id'], data_time=x['max_time'])
|
total_count_queryset = [DeviceCount.objects.filter(device_id=x['device_id'],
|
||||||
|
data_time=x['max_time']).order_by('-count')[0]
|
||||||
for x in DeviceCount.objects.values('device_id').annotate(max_time=Max('data_time'))]
|
for x in DeviceCount.objects.values('device_id').annotate(max_time=Max('data_time'))]
|
||||||
if total_count_queryset:
|
if total_count_queryset:
|
||||||
total_count = sum(map(lambda x: int(x.count), total_count_queryset))
|
total_count = sum(map(lambda x: int(x.count), total_count_queryset))
|
||||||
|
|
Loading…
Reference in New Issue