Private
Public Access
1
0

offline background cp chart creation

This commit is contained in:
Sander Roosendaal
2020-10-19 18:23:30 +02:00
parent 3497325a0d
commit f81d934739
3 changed files with 42 additions and 3 deletions

View File

@@ -2704,6 +2704,38 @@ def handle_sendemail_invite_reject(email, name, teamname, managername,
return 1
@app.task
def handle_setcp(strokesdf,filename,workoutid,debug=False,**kwargs):
try:
os.remove(filename)
except FileNotFoundError:
pass
if not strokesdf.empty:
totaltime = strokesdf['time'].max()
try:
powermean = strokesdf['power'].mean()
except KeyError:
powermean = 0
if powermean != 0:
thesecs = totaltime
maxt = 1.05 * thesecs
if maxt > 0:
logarr = datautils.getlogarr(maxt)
dfgrouped = strokesdf.groupby(['workoutid'])
delta, cpvalues, avgpower = datautils.getcp(dfgrouped, logarr)
df = pd.DataFrame({
'delta':delta,
'cp':cpvalues,
'id':workoutid,
})
df.to_parquet(filename,engine='fastparquet',compression='GZIP')
return 1
return 1
@app.task
def handle_sendemail_invite_accept(email, name, teamname, managername,
debug=False,**kwargs):