From 149df24059aded039bee85831e5ca79c3304c074 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 7 Jan 2021 18:34:58 +0100 Subject: [PATCH] switching to hrtss instead of trimp --- rowers/forms.py | 4 ++-- rowers/interactiveplots.py | 22 +++++++--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/rowers/forms.py b/rowers/forms.py index f2d73740..7429ca3c 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -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 ) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index b8418865..bfcb591f 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -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)