From cc48dada372a8863a18666d3ec40c0711abc1b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Tue, 2 Aug 2022 16:25:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E4=BA=8B=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=88=86=E7=BB=84?= 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, 10 insertions(+), 2 deletions(-) diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index be120aa..6a33298 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -392,6 +392,8 @@ async def event_model( if item.get('groups'): item['groups'] = np.array(item['groups'])[sort_key].tolist() groups = [] + groupbys=analysis.event_view.get('groupBy') + groupby_list=[i['columnName'] for i in groupbys] for gitem in item['groups']: gb = [] if '(' in gitem or '[' in gitem: @@ -409,8 +411,14 @@ async def event_model( gb.insert(idx, name) # 去掉分组表现里面的'' - appgb = str(gb).replace("'", '') - groups.append(appgb) + # appgb = str(gb).replace("'", '') + # groups.append(appgb) + # item['groups'] = groups + #修改后的方案 + by_dict={} + for i in range(len(gb)): + by_dict[groupby_list[i]]=gb[i] + groups.append(by_dict) item['groups'] = groups else: if group_label: