Private
Public Access
1
0

switching to hrtss instead of trimp

This commit is contained in:
Sander Roosendaal
2021-01-07 18:34:58 +01:00
parent d1aca60c15
commit 149df24059
2 changed files with 9 additions and 17 deletions

View File

@@ -721,14 +721,14 @@ class PerformanceManagerForm(forms.Form):
label='End Date')
metricchoices = (
('trimp','Use Heart Rate Data'),
('hrtss','Use Heart Rate Data'),
('rscore','Use Power and Heart Rate Data'),
)
metricchoice = forms.ChoiceField(
required=True,
choices=metricchoices,
initial='trimp',
initial='hrtss',
label='Data',
widget=forms.RadioSelect
)

View File

@@ -1743,34 +1743,26 @@ def getfatigues(
lambda_c = 2/(kfitness+1)
nrdays = (enddate-startdate).days
factor = 1.0
if metricchoice == 'rscore':
factor = 2.0
for i in range(nrdays+1):
date = startdate+datetime.timedelta(days=i)
ws = Workout.objects.filter(user=user.rower,date=date,duplicate=False)
weight = 0
for w in ws:
if getattr(w,metricchoice) > 0:
weight += factor*getattr(w,metricchoice)
weight += getattr(w,metricchoice)
if getattr(w,metricchoice) <= 0:
if metricchoice == 'rscore' and w.hrtss > 0:
weight+= factor*w.hrtss
elif metricchoice == 'rscore' and w.hrtss <= 0:
weight+= w.hrtss
else:
trimp,hrtss = dataprep.workout_trimp(w)
rscore,normp = dataprep.workout_rscore(w)
if w.rpe and w.rpe > 0:
dd = 3600*w.duration.hour+60*w.duration.minute+w.duration.second
dd = dd/3600
weight += factor*rpetotss[w.rpe]*dd
elif metricchoice == 'trimp' and w.trimp <= 0:
trimp,hrtss = dataprep.workout_trimp(w)
rscore,normp = dataprep.workout_rscore(w)
if w.rpe and w.rpe > 0:
dd = 3600*w.duration.hour+60*w.duration.minute+w.duration.second
dd = dd/3600
weight += 2*rpetotss[w.rpe]*dd
weight += rpetotss[w.rpe]*dd
impulses.append(weight)