111
This commit is contained in:
parent
7580c1e563
commit
57bb539d4d
@ -40,7 +40,7 @@ class CombinationEvent:
|
|||||||
result = round(result, 2)
|
result = round(result, 2)
|
||||||
elif self.format == 'integer':
|
elif self.format == 'integer':
|
||||||
result = result.astype(int)
|
result = result.astype(int)
|
||||||
return result.to_list(), result.sum(), round(result.mean(), 2)
|
return result.to_list(), round(result.sum(), 2), round(result.mean(), 2)
|
||||||
|
|
||||||
|
|
||||||
class CustomEvent:
|
class CustomEvent:
|
||||||
@ -641,7 +641,8 @@ ORDER BY level
|
|||||||
elif event.get('quota'):
|
elif event.get('quota'):
|
||||||
event_attr_col = getattr(self.event_tbl.c, event['quota'])
|
event_attr_col = getattr(self.event_tbl.c, event['quota'])
|
||||||
|
|
||||||
qry = sa.select(event_date_col,e_account_id_col, settings.CK_FUNC[analysis](event_attr_col).label('values')) \
|
qry = sa.select(event_date_col, e_account_id_col,
|
||||||
|
settings.CK_FUNC[analysis](event_attr_col).label('values')) \
|
||||||
.where(and_(*where)) \
|
.where(and_(*where)) \
|
||||||
.group_by(event_date_col, *self.groupby, e_account_id_col)
|
.group_by(event_date_col, *self.groupby, e_account_id_col)
|
||||||
sql = str(qry.compile(compile_kwargs={"literal_binds": True}))
|
sql = str(qry.compile(compile_kwargs={"literal_binds": True}))
|
||||||
@ -801,7 +802,7 @@ ORDER BY values desc"""
|
|||||||
days = (arrow.get(self.end_date).date() - arrow.get(self.start_date).date()).days
|
days = (arrow.get(self.end_date).date() - arrow.get(self.start_date).date()).days
|
||||||
keep = []
|
keep = []
|
||||||
cnt = []
|
cnt = []
|
||||||
for i in range(1,days + 1):
|
for i in range(1, days + 1):
|
||||||
keep.append(
|
keep.append(
|
||||||
f"""cnt{i + 1},round(cnt{i + 1} * 100 / cnt0, 2) as `p{i + 1}`""")
|
f"""cnt{i + 1},round(cnt{i + 1} * 100 / cnt0, 2) as `p{i + 1}`""")
|
||||||
cnt.append(f"""sum(if(dateDiff('day',a.reg_date,b.visit_date)={i},1,0)) as cnt{i + 1}""")
|
cnt.append(f"""sum(if(dateDiff('day',a.reg_date,b.visit_date)={i},1,0)) as cnt{i + 1}""")
|
||||||
|
Loading…
Reference in New Issue
Block a user