Private
Public Access
1
0

skips CP calculation when OTW workout has no power data

This commit is contained in:
Sander Roosendaal
2017-10-25 16:49:38 +02:00
parent 42d9b19a28
commit ae520e346f

View File

@@ -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: