From b11e75e456b8e83afc9f45fc3b0c03eafeaac5ea Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 3 Dec 2020 08:33:50 +0100 Subject: [PATCH] link to import and end fitness stat --- rowers/interactiveplots.py | 14 ++++++----- rowers/models.py | 12 +++++----- rowers/templates/performancemanager.html | 30 ++++++++++++++++++++++-- rowers/views/analysisviews.py | 8 ++++++- 4 files changed, 49 insertions(+), 15 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 3c3f7267..14711cc9 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1726,7 +1726,9 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7, 'impulse':impulses, }) - + endfitness = fitnesses[-1] + endfatigue = fatigues[-1] + endform = endfitness-endfatigue if modelchoice == 'banister': df['fatigue'] = k2*df['fatigue'] @@ -1865,10 +1867,10 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7, hover.tooltips = OrderedDict([ #(legend_label,'@testpower'), ('Date','@fdate'), - (fitlabel,'@fitness'), - (fatiguelabel,'@fatigue'), - (formlabel,'@form'), - ('Impulse','@impulse') + (fitlabel,'@fitness{int}'), + (fatiguelabel,'@fatigue{int}'), + (formlabel,'@form{int}'), + ('Impulse','@impulse{int}') ]) @@ -1908,7 +1910,7 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7, ) ) - return [script,div] + return [script,div,endfitness,endfatigue,endform] def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None, diff --git a/rowers/models.py b/rowers/models.py index 40348401..8a6663a3 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2907,15 +2907,15 @@ class Workout(models.Model): rpechoices = ( (0,'Not Specified'), (1,'1 Very Easy (a walk in the park)'), # 20 TSS / hour - (2,'2 Easy (talk, breathe normally, feels comfortable)'), # 30 TSS / hour - (3,'3 Somewhat easy (you can talk easily but did you notice the beautiful clouds?)'), - (4,'4 Moderate (talk in short spurts, breathing more labored, this feels just right)'), # 50 TSS/hour + (2,'2 Easy (You breathe normally, it feels comfortable)'), # 30 TSS / hour + (3,'3 Somewhat easy (You can talk easily but did you notice the beautiful clouds?)'), + (4,'4 Moderate (You can talk in short spurts, breathing more labored, this feels just right)'), # 50 TSS/hour (5,"5 (It's not that painful, you just don't want to be here all day.)"), - (6,'6 Somewhat Hard (you can say a few words if you need to)'), # 70 TSS / hour + (6,'6 Somewhat Hard (You can say a few words if you need to)'), # 70 TSS / hour (7,'7 Vigorous (This is starting to get painful)'), - (8,"8 Hard (Could barely talk, breathing heavily, hoping you won't have to this that long)"), # 100 TSS / hour + (8,"8 Hard (You can barely talk, breathing heavily, hoping you won't have to this that long)"), # 100 TSS / hour (9,'9 Very Hard (My goodness, please make it stop)'), # 120 TSS / hour - (10,'10 Max Effort (Could barely remember your name, you would rather rip out your toenails than go through this)') # 140 TSS / hour + (10,'10 Max Effort (You can barely remember your name, you would rather rip out your toenails than go through this)') # 140 TSS / hour ) user = models.ForeignKey(Rower,on_delete=models.CASCADE) diff --git a/rowers/templates/performancemanager.html b/rowers/templates/performancemanager.html index b5a14fab..4136e750 100644 --- a/rowers/templates/performancemanager.html +++ b/rowers/templates/performancemanager.html @@ -29,6 +29,9 @@ // var parsedJSON = $.parseJSON(data); // $("#id_script").replaceWith('
'+data.script+''); $("#id_chart").replaceWith('
'+data.div+''); + $("#endfitness").html(data.endfitness) + $("#endfatigue").html(data.endfatigue) + $("#endform").html(data.endform) console.log('done'); } }); @@ -84,7 +87,7 @@ {{ the_div|safe }}
-
  • +
  • {{ form.as_table }} @@ -109,6 +112,11 @@ on the left. The model balances out after a few weeks of regular training, so don't make this chart shorter than a few months.

    +

    + For this chart to reflect your fitness and freshness, it is important to have all workouts on + Rowsandall.com. You can automatically import workouts from other fitness platforms. Change + your Import and Export Settings here. +

    The time constants used in generating this performance chart were a fitness decay constant of {{ rower.kfit }} days @@ -116,7 +124,25 @@ You can change these values in your Profile Settings.

    - +
  • +
    +

    +

  • + + + + + + + + + + + +

    Fitness

    {{ endfitness }}

    Fatigue

    {{ endfatigue }}

    Freshness

    {{ endform }}

    +

    +
  • + diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index 23ebbf00..757444a5 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -1578,7 +1578,7 @@ def performancemanager_view(request,userid=0,mode='rower', else: form = PerformanceManagerForm() - script, thediv = performance_chart( + script, thediv, endfitness, endfatigue, endform = performance_chart( theuser,startdate=startdate,enddate=enddate, kfitness = kfitness, kfatigue = kfatigue, @@ -1602,6 +1602,9 @@ def performancemanager_view(request,userid=0,mode='rower', response = json.dumps({ 'script':script, 'div':thediv, + 'endform':int(endform), + 'endfitness': int(endfitness), + 'endfatigue': int(endfatigue), }) return(HttpResponse(response,content_type='application/json')) @@ -1616,6 +1619,9 @@ def performancemanager_view(request,userid=0,mode='rower', 'the_div':thediv, 'mode':mode, 'form':form, + 'endfitness':int(endfitness), + 'endfatigue':int(endfatigue), + 'endform':int(endform), })