From 9f56141c9767d9b8ce49f06a4ffa6876a528254b Mon Sep 17 00:00:00 2001 From: wuaho Date: Mon, 1 Nov 2021 12:30:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E6=98=BE=E9=9A=90=E6=8C=87?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 4 ++++ 1 file changed, 4 insertions(+) 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