works
This commit is contained in:
@@ -4978,6 +4978,8 @@ class InStrokeAnalysis(models.Model):
|
||||
end_second = models.IntegerField(default=3600)
|
||||
spm_min = models.IntegerField(default=10)
|
||||
spm_max = models.IntegerField(default=45)
|
||||
average_spm = models.FloatField(default=23)
|
||||
average_boatspeed = models.FloatField(default=4.0)
|
||||
|
||||
def __str__(self):
|
||||
s = 'In-Stroke Analysis {name} ({date})'.format(name = self.name,
|
||||
|
||||
@@ -143,8 +143,16 @@ $( function() {
|
||||
<label for="amount">Active Range:</label>
|
||||
<input type="text" id="amount" readonly style="border:0; color:#1c75bc; font-weight:bold;">
|
||||
</p>
|
||||
<p><input name='_form' class="button" type="submit" value="Submit"></p>
|
||||
<p><input name='_save' class="button" type="submit" value="Save"></p>
|
||||
<div class="buttoncontainer">
|
||||
<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>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
|
||||
@@ -3082,6 +3082,24 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
|
||||
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()
|
||||
messages.info(request,'In-Stroke Analysis saved')
|
||||
|
||||
|
||||
activesecondsmin = 60.*activeminutesmin
|
||||
activesecondsmax = 60.*activeminutesmax
|
||||
|
||||
@@ -3112,6 +3130,18 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
|
||||
intervalstats = rowdata.allstats()
|
||||
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
|
||||
|
||||
intervaldata = {
|
||||
'itime': itime,
|
||||
'idist': idist,
|
||||
|
||||
Reference in New Issue
Block a user