1.优化事件分析分组

This commit is contained in:
李伟 2022-08-02 16:25:24 +08:00
parent 27501bda49
commit cc48dada37

View File

@ -392,6 +392,8 @@ async def event_model(
if item.get('groups'): if item.get('groups'):
item['groups'] = np.array(item['groups'])[sort_key].tolist() item['groups'] = np.array(item['groups'])[sort_key].tolist()
groups = [] groups = []
groupbys=analysis.event_view.get('groupBy')
groupby_list=[i['columnName'] for i in groupbys]
for gitem in item['groups']: for gitem in item['groups']:
gb = [] gb = []
if '(' in gitem or '[' in gitem: if '(' in gitem or '[' in gitem:
@ -409,8 +411,14 @@ async def event_model(
gb.insert(idx, name) gb.insert(idx, name)
# 去掉分组表现里面的'' # 去掉分组表现里面的''
appgb = str(gb).replace("'", '') # appgb = str(gb).replace("'", '')
groups.append(appgb) # 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 item['groups'] = groups
else: else:
if group_label: if group_label: