1
This commit is contained in:
parent
078163290a
commit
ed5055e2e2
@ -108,7 +108,9 @@ async def copy(
|
||||
try:
|
||||
await crud.report.insert_one(db, new_report)
|
||||
except:
|
||||
pass
|
||||
exists_report = await crud.report.find_one(db, {'project_id': item['project_id'],
|
||||
'user_id': item['user_id'], 'name': report['name']})
|
||||
report['report_id'] = exists_report['_id']
|
||||
try:
|
||||
await crud.dashboard.update_one(db,
|
||||
{'project_id': item['project_id'], 'name': item['name'],
|
||||
|
@ -226,6 +226,8 @@ async def retention_model(request: Request,
|
||||
res = analysis.retention_model_sql2()
|
||||
sql = res['sql']
|
||||
df = await ckdb.query_dataframe(sql)
|
||||
if len(df) == 0:
|
||||
return schemas.Msg(code=-1, msg='无数据', data=None)
|
||||
|
||||
title = f'用户数'
|
||||
date_range = res['date_range']
|
||||
@ -556,7 +558,7 @@ async def scatter_model(
|
||||
if interval_type == 'def' and analysis == 'number_of_days':
|
||||
resp = {'list': {}}
|
||||
for key, tmp_df in df.groupby('date'):
|
||||
total = round(tmp_df['values'].sum(),2)
|
||||
total = round(tmp_df['values'].sum(), 2)
|
||||
resp['list'][key.strftime('%Y-%m-%d')] = {'n': total, 'total': total, 'p': 100}
|
||||
return schemas.Msg(code=0, msg='ok', data=resp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user