skips CP calculation when OTW workout has no power data
This commit is contained in:
@@ -733,24 +733,24 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
ishard = False
|
ishard = False
|
||||||
if workouttype == 'water':
|
if workouttype == 'water':
|
||||||
df = getsmallrowdata_db(['power', 'workoutid', 'time'], ids=[w.id])
|
df = getsmallrowdata_db(['power', 'workoutid', 'time'], ids=[w.id])
|
||||||
# delta,cpvalues,avgpower = datautils.getsinglecp(row.df)
|
if df['power'].mean():
|
||||||
thesecs = totaltime
|
thesecs = totaltime
|
||||||
maxt = 1.05 * thesecs
|
maxt = 1.05 * thesecs
|
||||||
if maxt > 0:
|
if maxt > 0:
|
||||||
logarr = datautils.getlogarr(maxt)
|
logarr = datautils.getlogarr(maxt)
|
||||||
dfgrouped = df.groupby(['workoutid'])
|
dfgrouped = df.groupby(['workoutid'])
|
||||||
delta, cpvalues, avgpower = datautils.getcp(dfgrouped, logarr)
|
delta, cpvalues, avgpower = datautils.getcp(dfgrouped, logarr)
|
||||||
|
|
||||||
res, btvalues, res2 = utils.isbreakthrough(
|
res, btvalues, res2 = utils.isbreakthrough(
|
||||||
delta, cpvalues, r.p0, r.p1, r.p2, r.p3, r.cpratio)
|
delta, cpvalues, r.p0, r.p1, r.p2, r.p3, r.cpratio)
|
||||||
else:
|
else:
|
||||||
res = 0
|
res = 0
|
||||||
res2 = 0
|
res2 = 0
|
||||||
if res:
|
if res:
|
||||||
isbreakthrough = True
|
isbreakthrough = True
|
||||||
res = datautils.updatecp(delta, cpvalues, r)
|
res = datautils.updatecp(delta, cpvalues, r)
|
||||||
if res2 and not isbreakthrough:
|
if res2 and not isbreakthrough:
|
||||||
ishard = True
|
ishard = True
|
||||||
|
|
||||||
# submit email task to send email about breakthrough workout
|
# submit email task to send email about breakthrough workout
|
||||||
if isbreakthrough:
|
if isbreakthrough:
|
||||||
|
|||||||
Reference in New Issue
Block a user