Private
Public Access
1
0

Merge branch 'release/v5.19'

This commit is contained in:
Sander Roosendaal
2017-11-27 22:05:19 +01:00
4 changed files with 119 additions and 1 deletions

View File

@@ -234,6 +234,13 @@
See (and save) the big interactive plot
</p>
</div>
<div class="grid_2">
<p>
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/instroke">In-Stroke Metrics</a></p>
<p>
If your workout has in-stroke metrics (like a stroke power curve or boat acceleration curve), you will find it here.
</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,80 @@
{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}Advanced Features {% endblock %}
{% block content %}
<div id="workouts" class="grid_6 alpha">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<h1>In Stroke Metrics</h1>
{% if user.rower.rowerplan == 'basic' %}
<p>This is a preview of the page with advanced functionality for Pro users. See <a href="/rowers/about">the About page</a> for more information and to sign up for Pro Membership</a>
{% endif %}
<div class="grid_2 alpha">
<p>
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/edit">Edit Workout</a>
</p>
</div>
<div class="grid_2">
<p>
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/advanced">Advanced Edit</a>
</p>
</div>
<div class="grid_2 omega">
<p>
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/export">Export</a>
</p>
</div>
<div class="grid_6 alpha">
<table width=100%>
<tr>
<th>Date:</th><td>{{ workout.date }}</td>
</tr><tr>
<th>Time:</th><td>{{ workout.starttime }}</td>
</tr><tr>
<th>Distance:</th><td>{{ workout.distance }}m</td>
</tr><tr>
<th>Duration:</th><td>{{ workout.duration |durationprint:"%H:%M:%S.%f" }}</td>
</tr>
<th>Public link to this workout</th>
<td>
<a href="/rowers/workout/{{ workout.id }}">https://rowsandall.com/rowers/workout/{{ workout.id }}</a>
<td>
</table>
</div>
<div class="grid_6 alpha">
{% if instrokemetrics %}
{% for metric in instrokemetrics %}
{% if forloop.first %}
<div class="grid_2 alpha">
{% else %}
<div class="grid_2">
{% endif %}
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/instroke/{{ metric }}">{{ metric }}</a>
</div>
{% endfor %}
{% else %}
<p>Unfortunately, this workout doesn't have any in stroke metrics</p>
{% endif %}
</div>
</div>
<div id="advancedplots" class="grid_6 omega">
<p>&nbsp;</p>
</div>
{% endblock %}

View File

@@ -224,6 +224,7 @@ urlpatterns = [
url(r'^workout/(?P<id>\d+)/geeky$',views.workout_geeky_view),
url(r'^workout/(?P<id>\d+)/advanced$',views.workout_advanced_view),
url(r'^workout/(?P<id>\d+)/instroke/(?P<metric>\w+.*)$',views.instroke_chart),
url(r'^workout/(?P<id>\d+)/instroke$',views.instroke_view),
url(r'^workout/(?P<id>\d+)/stats$',views.workout_stats_view),
url(r'^workout/(?P<id>\d+)/otwsetpower$',views.workout_otwsetpower_view),
url(r'^workout/(?P<id>\d+)/interactiveotwplot$',views.workout_otwpowerplot_view),

View File

@@ -6436,6 +6436,35 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
'form':form,
})
@login_required()
def instroke_view(request,id=0):
try:
row = Workout.objects.get(id=id)
except Workout.DoesNotExist:
raise Http404("Workout doesn't exist")
form = WorkoutForm(instance=row)
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
# check if user is owner of this workout
if (checkworkoutuser(request.user,row)==False):
message = "You are not allowed to edit this workout"
messages.error(request,message)
url = reverse(workouts_view)
return HttpResponseRedirect(url)
rowdata = rrdata(csvfile=row.csvfilename)
instrokemetrics = rowdata.get_instroke_columns()
return render(request,
'instroke.html',
{'workout':row,
'teams':get_my_teams(request.user),
'instrokemetrics':instrokemetrics,
})
# A special Edit page with all the Geeky functionality for the workout
@login_required()
def workout_geeky_view(request,id=0,message="",successmessage=""):
@@ -6548,7 +6577,8 @@ def instroke_chart(request,id=0,metric=''):
i.save()
print i.id,'aap'
url = reverse(workout_geeky_view,
r = getrower(request.user)
url = reverse(r.defaultlandingpage,
kwargs = {
'id':id,
})