去掉当日留存
This commit is contained in:
parent
577761583b
commit
7d7a3801c3
@ -91,7 +91,8 @@ async def add_policy(
|
|||||||
res = 0
|
res = 0
|
||||||
for path in data_id.path_list:
|
for path in data_id.path_list:
|
||||||
res = casbin_enforcer.add_policy(data_id.role_id, data_id.game, path, data_id.act)
|
res = casbin_enforcer.add_policy(data_id.role_id, data_id.game, path, data_id.act)
|
||||||
casbin_enforcer.load_model()
|
# casbin_enforcer.load_model()
|
||||||
|
casbin_enforcer.load_policy()
|
||||||
return schemas.Msg(code=0, msg='ok', data=res)
|
return schemas.Msg(code=0, msg='ok', data=res)
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +106,8 @@ async def remove_policy(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
res = casbin_enforcer.remove_policy(data_id.role_id, data_id.game, data_id.path, data_id.act)
|
res = casbin_enforcer.remove_policy(data_id.role_id, data_id.game, data_id.path, data_id.act)
|
||||||
casbin_enforcer.load_model()
|
# casbin_enforcer.load_model()
|
||||||
|
casbin_enforcer.load_policy()
|
||||||
return schemas.Msg(code=0, msg='ok', data=res)
|
return schemas.Msg(code=0, msg='ok', data=res)
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ async def retention_model(request: Request,
|
|||||||
for i in set(date_range) - set(df.index):
|
for i in set(date_range) - set(df.index):
|
||||||
df.loc[i] = 0
|
df.loc[i] = 0
|
||||||
df.sort_index(inplace=True)
|
df.sort_index(inplace=True)
|
||||||
days = [i for i in range(unit_num + 1)]
|
days = [i for i in range(1,unit_num + 1)]
|
||||||
summary_values = {}
|
summary_values = {}
|
||||||
today = datetime.datetime.today().date()
|
today = datetime.datetime.today().date()
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ async def retention_model(request: Request,
|
|||||||
tmp['n'] = []
|
tmp['n'] = []
|
||||||
tmp['p_outflow'] = []
|
tmp['p_outflow'] = []
|
||||||
tmp['n_outflow'] = []
|
tmp['n_outflow'] = []
|
||||||
for i in range((today - date).days + 1):
|
for i in range(1, (today - date).days + 1):
|
||||||
if i > unit_num:
|
if i > unit_num:
|
||||||
break
|
break
|
||||||
p = float(getattr(value, f'p{i + 1}'))
|
p = float(getattr(value, f'p{i + 1}'))
|
||||||
@ -661,14 +661,14 @@ async def scatter_model(
|
|||||||
resp['list'][key.strftime('%Y-%m-%d')] = {'n': total, 'total': total, 'p': 100}
|
resp['list'][key.strftime('%Y-%m-%d')] = {'n': total, 'total': total, 'p': 100}
|
||||||
return schemas.Msg(code=0, msg='ok', data=resp)
|
return schemas.Msg(code=0, msg='ok', data=resp)
|
||||||
|
|
||||||
# bins_s = pd.cut(tmp_df['values'], bins=bins,
|
# bins_s = pd.cut(tmp_df['values'], bins=bins,
|
||||||
# right=False).value_counts()
|
# right=False).value_counts()
|
||||||
# bins_s.sort_index(inplace=True)
|
# bins_s.sort_index(inplace=True)
|
||||||
# total = int(bins_s.sum())
|
# total = int(bins_s.sum())
|
||||||
# resp['list'][key.strftime('%Y-%m-%d')] = dict()
|
# resp['list'][key.strftime('%Y-%m-%d')] = dict()
|
||||||
# resp['list'][key.strftime('%Y-%m-%d')]['总体'] = {'n': bins_s.to_list(), 'total': total,
|
# resp['list'][key.strftime('%Y-%m-%d')]['总体'] = {'n': bins_s.to_list(), 'total': total,
|
||||||
# 'p': round(bins_s * 100 / total, 2).to_list(),
|
# 'p': round(bins_s * 100 / total, 2).to_list(),
|
||||||
# 'title': '总体'}
|
# 'title': '总体'}
|
||||||
|
|
||||||
|
|
||||||
@router.post("/trace_model_sql")
|
@router.post("/trace_model_sql")
|
||||||
|
@ -801,7 +801,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(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