From 2fc593f0976cb2baa1e0e96ce712b94e870cfb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Thu, 13 Jan 2022 14:19:02 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E5=9F=BA=E7=A1=80=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9C=8B=E6=9D=BF=E5=A4=9A=E5=8A=A0=E4=BA=86=E7=99=BE?= =?UTF-8?q?=E5=88=86=E5=8F=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 883a733..0880ff8 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -181,10 +181,14 @@ async def event_model( if last_value > 0: q['last_value'] = float(last_value) break - for i in range(len(values)): - values[i]=str(values[i])+'%' - q['values'].append(values) - q['sum'].append(str(sum_)+'%') + if list(item.get('event_name'))[-1] == '率': + for i in range(len(values)): + values[i]=str(values[i])+'%' + q['values'].append(values) + q['sum'].append(str(sum_)+'%') + else: + q['values'].append(values) + q['sum'].append(sum_) res.append(q) continue #sql语句