Merge branch 'feature/instroke' into develop
This commit is contained in:
@@ -4978,6 +4978,8 @@ class InStrokeAnalysis(models.Model):
|
|||||||
end_second = models.IntegerField(default=3600)
|
end_second = models.IntegerField(default=3600)
|
||||||
spm_min = models.IntegerField(default=10)
|
spm_min = models.IntegerField(default=10)
|
||||||
spm_max = models.IntegerField(default=45)
|
spm_max = models.IntegerField(default=45)
|
||||||
|
average_spm = models.FloatField(default=23)
|
||||||
|
average_boatspeed = models.FloatField(default=4.0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = 'In-Stroke Analysis {name} ({date})'.format(name = self.name,
|
s = 'In-Stroke Analysis {name} ({date})'.format(name = self.name,
|
||||||
|
|||||||
@@ -51,7 +51,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="workoutelement">
|
<div class="workoutelement">
|
||||||
<span style="color:#555">Workout</span><br>
|
<span style="color:#555">Workout</span><br>
|
||||||
{{ analysis.workout }}
|
<span>{{ analysis.workout.name }}</span><br>
|
||||||
|
<span>{{ analysis.workout.date }}, {{ analysis.workout.distance }}m</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="workoutelement">
|
<div class="workoutelement">
|
||||||
<span style="color:#555">Metric</span><br>
|
<span style="color:#555">Metric</span><br>
|
||||||
@@ -69,6 +70,11 @@
|
|||||||
<span style="color:#555">Time</span><br>
|
<span style="color:#555">Time</span><br>
|
||||||
{{ analysis.start_second|secondstotimestring }} - {{ analysis.end_second|secondstotimestring }}
|
{{ analysis.start_second|secondstotimestring }} - {{ analysis.end_second|secondstotimestring }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
<span style="color:#555">Avg Pace</span><br>
|
||||||
|
{{ analysis.average_boatspeed|velotopace }}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -143,8 +143,16 @@ $( function() {
|
|||||||
<label for="amount">Active Range:</label>
|
<label for="amount">Active Range:</label>
|
||||||
<input type="text" id="amount" readonly style="border:0; color:#1c75bc; font-weight:bold;">
|
<input type="text" id="amount" readonly style="border:0; color:#1c75bc; font-weight:bold;">
|
||||||
</p>
|
</p>
|
||||||
<p><input name='_form' class="button" type="submit" value="Submit"></p>
|
<div class="buttoncontainer">
|
||||||
<p><input name='_save' class="button" type="submit" value="Save"></p>
|
<input name='_form' class="button" type="submit" value="Submit">
|
||||||
|
<input name='_save' class="button" type="submit" value="Save">
|
||||||
|
<input name='_save_as_new' class="button" type="submit" value="Save as New">
|
||||||
|
<p>
|
||||||
|
With the Save buttons, you can save your analysis for future use and to compare
|
||||||
|
multiple analyses to each other. You can find the saved analyses under the Analysis
|
||||||
|
tab (<a href="/rowers/analysis/instrokeanalysis/">in-stroke analysis</a>).
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import math
|
|||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from rowers.utils import calculate_age
|
from rowers.utils import calculate_age, to_pace
|
||||||
from rowers.models import (
|
from rowers.models import (
|
||||||
course_length, WorkoutComment,
|
course_length, WorkoutComment,
|
||||||
TrainingMacroCycle, TrainingMesoCycle, TrainingMicroCycle,
|
TrainingMacroCycle, TrainingMesoCycle, TrainingMicroCycle,
|
||||||
@@ -491,6 +491,14 @@ def previousperiodstart(timeperiod):
|
|||||||
|
|
||||||
return newstartdate.strftime("%Y-%m-%d")
|
return newstartdate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def velotopace(v):
|
||||||
|
if v > 0:
|
||||||
|
time500 = 500./v
|
||||||
|
return to_pace(time500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def paceprint(d):
|
def paceprint(d):
|
||||||
|
|||||||
@@ -3039,7 +3039,7 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
|
|||||||
div = get_call()
|
div = get_call()
|
||||||
|
|
||||||
|
|
||||||
|
dosave = False
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = InstrokeForm(request.POST,choices=instrokemetrics)
|
form = InstrokeForm(request.POST,choices=instrokemetrics)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
@@ -3079,6 +3079,26 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
|
|||||||
instroke_analysis.rower=w.user
|
instroke_analysis.rower=w.user
|
||||||
|
|
||||||
instroke_analysis.save()
|
instroke_analysis.save()
|
||||||
|
dosave = True
|
||||||
|
messages.info(request,'In-Stroke Analysis saved')
|
||||||
|
|
||||||
|
|
||||||
|
if "_save_as_new" in request.POST:
|
||||||
|
instroke_analysis = InStrokeAnalysis(
|
||||||
|
workout = w,
|
||||||
|
metric = metric,
|
||||||
|
name = name,
|
||||||
|
date = timezone.now().date(),
|
||||||
|
notes = notes,
|
||||||
|
start_second = 60*activeminutesmin,
|
||||||
|
end_second = 60*activeminutesmax,
|
||||||
|
spm_min = spm_min,
|
||||||
|
spm_max = spm_max,
|
||||||
|
rower=w.user,
|
||||||
|
)
|
||||||
|
|
||||||
|
instroke_analysis.save()
|
||||||
|
dosave = True
|
||||||
messages.info(request,'In-Stroke Analysis saved')
|
messages.info(request,'In-Stroke Analysis saved')
|
||||||
|
|
||||||
|
|
||||||
@@ -3112,6 +3132,21 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
|
|||||||
intervalstats = rowdata.allstats()
|
intervalstats = rowdata.allstats()
|
||||||
itime, idist, itype = rowdata.intervalstats_values()
|
itime, idist, itype = rowdata.intervalstats_values()
|
||||||
|
|
||||||
|
|
||||||
|
totaldist = 0
|
||||||
|
totaltime = 0
|
||||||
|
avg_speed = 0
|
||||||
|
for i in range(len(idist)):
|
||||||
|
if itype[i] == 4:
|
||||||
|
totaldist += idist[i]
|
||||||
|
totaltime += itime[i]
|
||||||
|
|
||||||
|
if totaltime > 0:
|
||||||
|
avg_speed = totaldist/totaltime
|
||||||
|
if dosave:
|
||||||
|
instroke_analysis.average_boatspeed = avg_speed
|
||||||
|
instroke_analysis.save()
|
||||||
|
|
||||||
intervaldata = {
|
intervaldata = {
|
||||||
'itime': itime,
|
'itime': itime,
|
||||||
'idist': idist,
|
'idist': idist,
|
||||||
|
|||||||
@@ -377,6 +377,11 @@ th.rotate > div > span {
|
|||||||
margin-top: 50%;
|
margin-top: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttoncontainer input {
|
||||||
|
float: left;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.divlines {
|
.divlines {
|
||||||
display: block;
|
display: block;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
@@ -397,7 +402,7 @@ th.rotate > div > span {
|
|||||||
|
|
||||||
.analysiscontainer {
|
.analysiscontainer {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 50px repeat(auto-fit, minmax(calc((100% - 100px)/7), 1fr));
|
grid-template-columns: 50px repeat(auto-fit, minmax(calc((100% - 100px)/8), 1fr));
|
||||||
/* grid-template-columns: 50px repeat(auto-fit, minmax(100px, 1fr)) 50px; ????*/
|
/* grid-template-columns: 50px repeat(auto-fit, minmax(100px, 1fr)) 50px; ????*/
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|||||||
Reference in New Issue
Block a user