offline background cp chart creation
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user