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
|
||||
if workouttype == 'water':
|
||||
df = getsmallrowdata_db(['power', 'workoutid', 'time'], ids=[w.id])
|
||||
# delta,cpvalues,avgpower = datautils.getsinglecp(row.df)
|
||||
thesecs = totaltime
|
||||
maxt = 1.05 * thesecs
|
||||
if maxt > 0:
|
||||
logarr = datautils.getlogarr(maxt)
|
||||
dfgrouped = df.groupby(['workoutid'])
|
||||
delta, cpvalues, avgpower = datautils.getcp(dfgrouped, logarr)
|
||||
if df['power'].mean():
|
||||
thesecs = totaltime
|
||||
maxt = 1.05 * thesecs
|
||||
if maxt > 0:
|
||||
logarr = datautils.getlogarr(maxt)
|
||||
dfgrouped = df.groupby(['workoutid'])
|
||||
delta, cpvalues, avgpower = datautils.getcp(dfgrouped, logarr)
|
||||
|
||||
res, btvalues, res2 = utils.isbreakthrough(
|
||||
delta, cpvalues, r.p0, r.p1, r.p2, r.p3, r.cpratio)
|
||||
else:
|
||||
res = 0
|
||||
res2 = 0
|
||||
if res:
|
||||
isbreakthrough = True
|
||||
res = datautils.updatecp(delta, cpvalues, r)
|
||||
if res2 and not isbreakthrough:
|
||||
ishard = True
|
||||
res, btvalues, res2 = utils.isbreakthrough(
|
||||
delta, cpvalues, r.p0, r.p1, r.p2, r.p3, r.cpratio)
|
||||
else:
|
||||
res = 0
|
||||
res2 = 0
|
||||
if res:
|
||||
isbreakthrough = True
|
||||
res = datautils.updatecp(delta, cpvalues, r)
|
||||
if res2 and not isbreakthrough:
|
||||
ishard = True
|
||||
|
||||
# submit email task to send email about breakthrough workout
|
||||
if isbreakthrough:
|
||||
|
||||
Reference in New Issue
Block a user