getting it to work
This commit is contained in:
@@ -1480,9 +1480,15 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
r.running_wps = 400.
|
||||
r.save()
|
||||
|
||||
|
||||
if w.workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif w.workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
_ = myqueue(queuehigh, handle_calctrimp, w.id, f2,
|
||||
r.ftp, r.sex, r.hrftp, r.max, r.rest)
|
||||
r.ftp, r.sex, r.hrftp, r.max, r.rest, wps_avg)
|
||||
|
||||
return (w.id, message)
|
||||
|
||||
@@ -1771,8 +1777,15 @@ def new_workout_from_df(r, df,
|
||||
rpe=rpe,
|
||||
consistencychecks=False)
|
||||
|
||||
if workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
_ = myqueue(queuehigh, handle_calctrimp, id, csvfilename,
|
||||
r.ftp, r.sex, r.hrftp, r.max, r.rest)
|
||||
r.ftp, r.sex, r.hrftp, r.max, r.rest, wps_avg)
|
||||
|
||||
return (id, message)
|
||||
|
||||
@@ -1814,7 +1827,14 @@ def workout_trimp(w, reset=False):
|
||||
return 0, 100.*(w.averagehr/r.hrftp)*(w.duration.hour*60 + w.duration.minute)/60.
|
||||
except ZeroDivisionError:
|
||||
return 0, 0
|
||||
|
||||
|
||||
if w.workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif w.workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
ftp = float(r.ftp)
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
@@ -1825,7 +1845,9 @@ def workout_trimp(w, reset=False):
|
||||
r.sex,
|
||||
r.hrftp,
|
||||
r.max,
|
||||
r.rest)
|
||||
r.rest,
|
||||
wps_avg,
|
||||
)
|
||||
return w.trimp, w.hrtss
|
||||
elif w.trimp > -1 and not reset:
|
||||
return w.trimp, w.hrtss
|
||||
@@ -1857,6 +1879,13 @@ def workout_trimp(w, reset=False):
|
||||
w.maxhr = maxhr
|
||||
w.save()
|
||||
|
||||
if w.workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif w.workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
handle_calctrimp,
|
||||
@@ -1866,7 +1895,8 @@ def workout_trimp(w, reset=False):
|
||||
r.sex,
|
||||
r.hrftp,
|
||||
r.max,
|
||||
r.rest)
|
||||
r.rest,
|
||||
wps_avg,)
|
||||
|
||||
trimp = 0
|
||||
averagehr = 0
|
||||
@@ -1877,6 +1907,45 @@ def workout_trimp(w, reset=False):
|
||||
|
||||
return trimp, averagehr
|
||||
|
||||
def workout_spmtss(w, reset=False):
|
||||
if w.spmtss > -1 and not reset:
|
||||
return w.spmtss
|
||||
|
||||
if get_existing_job(w):
|
||||
return 0, 0
|
||||
|
||||
r = w.user
|
||||
ftp = float(r.ftp)
|
||||
if w.workouttype in otwtypes:
|
||||
ftp = ftp*(100.-r.otwslack)/100.
|
||||
|
||||
if r.hrftp == 0:
|
||||
hrftp = (r.an+r.tr)/2.
|
||||
r.hrftp = int(hrftp)
|
||||
r.save()
|
||||
|
||||
if w.workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif w.workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
handle_calctrimp,
|
||||
w.id,
|
||||
w.csvfilename,
|
||||
ftp,
|
||||
r.sex,
|
||||
r.hrftp,
|
||||
r.max,
|
||||
r.rest,
|
||||
wps_avg,)
|
||||
|
||||
return w.spmtss
|
||||
|
||||
|
||||
|
||||
def workout_rscore(w, reset=False):
|
||||
dologging('metrics.log','Workout_rscore for {w} {id}, {reset}'.format(
|
||||
@@ -1906,6 +1975,13 @@ def workout_rscore(w, reset=False):
|
||||
r.save()
|
||||
|
||||
dologging('metrics.log','Queueing an asynchronous task')
|
||||
|
||||
if w.workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif w.workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
@@ -1916,7 +1992,8 @@ def workout_rscore(w, reset=False):
|
||||
r.sex,
|
||||
r.hrftp,
|
||||
r.max,
|
||||
r.rest)
|
||||
r.rest,
|
||||
wps_avg,)
|
||||
|
||||
return w.rscore, w.normp
|
||||
|
||||
@@ -1938,6 +2015,13 @@ def workout_normv(w, pp=4.0):
|
||||
r.hrftp = int(hrftp)
|
||||
r.save()
|
||||
|
||||
if w.workouttype in otwtypes:
|
||||
wps_avg = r.median_wps
|
||||
elif w.workouttype in otetypes:
|
||||
wps_avg = r.median_wps_erg
|
||||
else:
|
||||
wps_avg = 0
|
||||
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
handle_calctrimp,
|
||||
@@ -1947,6 +2031,6 @@ def workout_normv(w, pp=4.0):
|
||||
r.sex,
|
||||
r.hrftp,
|
||||
r.max,
|
||||
r.rest)
|
||||
r.rest, wps_avg)
|
||||
|
||||
return 0, 0
|
||||
|
||||
Reference in New Issue
Block a user