diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 40273d8..1844886 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -174,6 +174,10 @@ async def event_model( q['sum'].append(sum_) q['avg'].append(avg) q['date_range'] = item['date_range'] + for last_value in values[::-1]: + if last_value > 0: + q['last_value'] = float(last_value) + break res.append(q) continue