Private
Public Access
1
0

link to import and end fitness stat

This commit is contained in:
Sander Roosendaal
2020-12-03 08:33:50 +01:00
parent 6fc4e33e39
commit b11e75e456
4 changed files with 49 additions and 15 deletions

View File

@@ -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,

View File

@@ -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)

View File

@@ -29,6 +29,9 @@
// var parsedJSON = $.parseJSON(data); //
$("#id_script").replaceWith('<div id="id_script">'+data.script+'</d'+'iv>');
$("#id_chart").replaceWith('<div id="id_chart">'+data.div+'</d'+'iv>');
$("#endfitness").html(data.endfitness)
$("#endfatigue").html(data.endfatigue)
$("#endform").html(data.endform)
console.log('done');
}
});
@@ -84,7 +87,7 @@
{{ the_div|safe }}
</div>
</li>
<li class="grid_2">
<li class="grid_1">
<form id="performanceform" enctype="multipart/form-data" method="post">
<table>
{{ 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.
</p>
<p>
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 <a href="/rowers/me/exportsettings/">Import and Export Settings here.</a>
</p>
<p>
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 <a href="/rowers/me/preferences/">Profile Settings</a>.
</p>
</li>
<li class="grid_1">
<div class="rounder">
<p>
<table width="100%">
<tbody>
<tr>
<td><h2>Fitness</h2></td><td><h2><span id="endfitness">{{ endfitness }}</span></h2></td>
</tr>
<tr>
<td><h2>Fatigue</h2></td><td><h2><span id="endfatigue"> {{ endfatigue }}</span></h2></td>
</tr>
<tr>
<td><h2>Freshness</h2></td><td><h2><span id="endform"> {{ endform }}</span></h2></td>
</tr>
</tbody>
</table>
</p>
</div>
</li>
</ul>

View File

@@ -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),
})