Private
Public Access
1
0

added hrScore to stats and plannedsessions

in plannedsessions, if rScore = 0, taking hrScore
This commit is contained in:
Sander Roosendaal
2018-04-09 10:30:55 +02:00
parent 3ec4494342
commit f3ecaab599
4 changed files with 33 additions and 10 deletions

View File

@@ -111,8 +111,13 @@ def get_session_metrics(ps):
for w in ws:
distancev += w.distance
durationv += timefield_to_seconds_duration(w.duration)
trimpv += dataprep.workout_trimp(w)
rscorev += dataprep.workout_rscore(w)[0]
thetrimp,hrtss = dataprep.workout_trimp(w)
trimpv += thetrimp
tss = dataprep.workout_rscore(w)[0]
if not np.isnan(tss) and tss != 0:
rscorev += tss
elif tss == 0:
rscorev += hrtss
ratio,statusv,completiondate = is_session_complete_ws(ws,ps)
try:
@@ -181,11 +186,16 @@ def is_session_complete_ws(ws,ps):
durationseconds = timefield_to_seconds_duration(w.duration)
score += durationseconds
elif ps.sessionmode == 'TRIMP':
trimp = dataprep.workout_trimp(w)
trimp,hrtss = dataprep.workout_trimp(w)
score += trimp
elif ps.sessionmode == 'rScore':
rscore = dataprep.workout_rscore(w)[0]
score += rscore
if not np.isnan(rscore) and rscore != 0:
score += rscore
elif rscore == 0:
trimp,hrtss = dataprep.workout_trimp(w)
score += hrtss
if not completiondate and score>=cratiomin*value:
completiondate = w.date