控制显隐指标
This commit is contained in:
parent
aec4ebf825
commit
362a1cb1d2
@ -148,7 +148,12 @@ async def event_model(
|
||||
await analysis.init(data_where=current_user.data_where)
|
||||
sqls = await analysis.event_model_sql()
|
||||
res = []
|
||||
for item in sqls:
|
||||
is_hide = []
|
||||
|
||||
for idx, item in enumerate(sqls):
|
||||
if item.get('is_show') == False:
|
||||
is_hide.append(idx)
|
||||
|
||||
q = {
|
||||
'groups': [],
|
||||
'values': [],
|
||||
@ -262,6 +267,7 @@ async def event_model(
|
||||
item['values'] = np.array(item['values'])[sort_key].tolist()
|
||||
item['sum'] = np.array(item['sum'])[sort_key].tolist()
|
||||
item['avg'] = np.array(item['avg'])[sort_key].tolist()
|
||||
res = [item for idx, item in enumerate(res) if idx not in is_hide]
|
||||
|
||||
return schemas.Msg(code=0, msg='ok', data=res)
|
||||
|
||||
|
@ -220,7 +220,6 @@ class BehaviorAnalysis:
|
||||
# self.event_tbl = sa.Table('event_view', metadata, *[sa.Column(column) for column in columns])
|
||||
self.event_tbl = sa.Table('event', metadata, *[sa.Column(column) for column in columns])
|
||||
|
||||
|
||||
async def handler_filts(self, *filters):
|
||||
"""
|
||||
|
||||
@ -252,7 +251,6 @@ class BehaviorAnalysis:
|
||||
else:
|
||||
event_filter.append(sa.Column('#account_id').notin_(sub_qry))
|
||||
|
||||
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
@ -260,7 +258,6 @@ class BehaviorAnalysis:
|
||||
tbl = getattr(self, f'{item["tableType"]}_tbl')
|
||||
col = getattr(tbl.c, item['columnName'])
|
||||
|
||||
|
||||
ftv = item['ftv']
|
||||
if comparator == '==':
|
||||
if len(ftv) > 1:
|
||||
@ -379,6 +376,7 @@ class BehaviorAnalysis:
|
||||
|
||||
for event in self.events:
|
||||
event_name_display = event.get('eventNameDisplay')
|
||||
is_show = event.get('is_show', True)
|
||||
|
||||
select_exprs = []
|
||||
if self.time_particle != 'total':
|
||||
@ -420,7 +418,8 @@ class BehaviorAnalysis:
|
||||
'end_date': self.end_date[:10],
|
||||
'event_name': event.get('eventNameDisplay'),
|
||||
'format': event.get('format') or 'float',
|
||||
'date_range': self.date_range
|
||||
'date_range': self.date_range,
|
||||
'is_show': is_show,
|
||||
}
|
||||
)
|
||||
continue
|
||||
@ -482,7 +481,7 @@ class BehaviorAnalysis:
|
||||
'time_particle': self.time_particle,
|
||||
'start_date': self.start_date[:10],
|
||||
'end_date': self.end_date[:10],
|
||||
|
||||
'is_show': is_show,
|
||||
})
|
||||
|
||||
return sqls
|
||||
|
Loading…
Reference in New Issue
Block a user