diff --git a/rowers/templates/advancededit.html b/rowers/templates/advancededit.html index 267be786..0e40362b 100644 --- a/rowers/templates/advancededit.html +++ b/rowers/templates/advancededit.html @@ -7,115 +7,132 @@ {% block content %}
- {% if form.errors %} -

- Please correct the error{{ form.errors|pluralize }} below. -

- {% endif %} + {% if form.errors %} +

+ Please correct the error{{ form.errors|pluralize }} below. +

+ {% endif %} -

Advanced Workout Editor

- {% if user.rower.rowerplan == 'basic' %} -

This is a preview of the page with advanced functionality for Pro users. See the page about Pro membership for more information and to sign up for Pro Membership - {% endif %} -

-

- Edit Workout -

-
-
-

- Export -

+

Advanced Workout Editor

+ {% if user.rower.rowerplan == 'basic' %} +

This is a preview of the page with advanced functionality for Pro users. + See + the page about Pro membership for more information and to sign up for Pro Membership +{% endif %} +

+

+ Edit Workout +

+
+
+

+ Export +

-
-
+
+
- - - - - - - - - - - -
Date:{{ workout.date }}
Time:{{ workout.starttime }}
Distance:{{ workout.distance }}m
Duration:{{ workout.duration |durationprint:"%H:%M:%S.%f" }}
Public link to this workout - https://rowsandall.com/rowers/workout/{{ workout.id }} - -
+ + + + + + + + + + + +
Date:{{ workout.date }}
Time:{{ workout.starttime }}
Distance:{{ workout.distance }}m
Duration:{{ workout.duration |durationprint:"%H:%M:%S.%f" }}
Public link to this workout + https://rowsandall.com/rowers/workout/{{ workout.id }} + +
-
- {% if user.rower.rowerplan == 'pro' %} - Compare Workouts - {% else %} - Compare Workouts - {% endif %} -

- Compare this workout to other workouts. Plot HR, SPM, or pace vs time or distance for the two workouts. -

-
-
- - Flexible Interactive Plot - -

- Flexible Interactive plot. Pick your own X and Y axis parameters. -

-
+
+ {% if user.rower.rowerplan == 'pro' %} + Compare Workouts + {% else %} + Compare Workouts + {% endif %} +

+ Compare this workout to other workouts. Plot HR, SPM, or pace vs time or distance for the two workouts. +

+
+
+ + Flexible Interactive Plot + +

+ Flexible Interactive plot. Pick your own X and Y axis parameters. +

+
-
-

- {% if user.rower.rowerplan == 'pro' %} - Edit Intervals - {% else %} - Edit Intervals - {% endif %} -

- Enter or change the interval and summary data for your workout +
+

+ {% if user.rower.rowerplan == 'pro' %} + Edit Intervals + {% else %} + Edit Intervals + {% endif %} +

+ Enter or change the interval and summary data for your workout -

-Enter or change the interval and summary data for your workout -

-
-
+

+ Enter or change the interval and summary data for your workout +

+
+
-
-

- {% if user.rower.rowerplan == 'pro' %} - Dist Metrics Plot - {% else %} - Dist Metrics Plot - {% endif %} -

-

- Various advanced stroke metrics plotted versus distance. -

-
-
-

- {% if user.rower.rowerplan == 'pro' %} - Time Metrics Plot - {% else %} - Time Metrics Plot - {% endif %} -

-

- Various advanced stroke metrics plotted versus time. -

-
-
-

- Big Interactive Plot -

-

- See (and save) the big interactive plot -

-
+
+

+ {% if user.rower.rowerplan == 'pro' %} + Dist Metrics Plot + {% else %} + Dist Metrics Plot + {% endif %} +

+

+ Various advanced stroke metrics plotted versus distance. +

+
+
+

+ {% if user.rower.rowerplan == 'pro' %} + Time Metrics Plot + {% else %} + Time Metrics Plot + {% endif %} +

+

+ Various advanced stroke metrics plotted versus time. +

+
+
+

+ Big Interactive Plot +

+

+ See (and save) the big interactive plot +

+
+
+
+ +
+

+ {% if user.rower.rowerplan == 'pro' %} + Power Histogram + {% else %} + Dist Metrics Plot + {% endif %} +

+

+ Plot the Power Histogram of this workout +

+
@@ -155,4 +172,4 @@ Enter or change the interval and summary data for your workout -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/rowers/templates/histo_single.html b/rowers/templates/histo_single.html new file mode 100644 index 00000000..042acf0f --- /dev/null +++ b/rowers/templates/histo_single.html @@ -0,0 +1,66 @@ +{% extends "base.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}View Workout {% endblock %} + +{% block content %} + + + + + {{ interactiveplot |safe }} + + + + + + + + + +
+

Indoor Rower Power Histogram

+
+ + +
+ + {{ the_div|safe }} + +
+ +{% endblock %} diff --git a/rowers/tests.py b/rowers/tests.py index 32d65884..8f075065 100644 --- a/rowers/tests.py +++ b/rowers/tests.py @@ -425,6 +425,9 @@ class ViewTest(TestCase): response = self.c.get('/rowers/workout/1/interactiveplot', form_data, follow=True) self.assertEqual(response.status_code, 200) + response = self.c.get('/rowers/workout/1/histo', form_data, follow=True) + self.assertEqual(response.status_code, 200) + w = Workout.objects.get(id=1) diff --git a/rowers/urls.py b/rowers/urls.py index b310bfaf..fb81b0da 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -56,6 +56,7 @@ urlpatterns = [ url(r'^graph/(\d+)/delete$',views.graph_delete_view), url(r'^workout/upload/$',views.workout_upload_view), url(r'^workout/upload/(.+.*)$',views.workout_upload_view), + url(r'^workout/(?P\d+)/histo$',views.workout_histo_view), url(r'^workout/(?P\d+)/export/c/(?P\w+.*)/s/(?P\w+.*)$',views.workout_export_view), url(r'^workout/(?P\d+)/export/c/(?P\w+.*)$',views.workout_export_view), url(r'^workout/(?P\d+)/export/s/(?P\w+.*)$',views.workout_export_view), diff --git a/rowers/views.py b/rowers/views.py index 3fa3ca8d..0c940311 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -1342,6 +1342,36 @@ def cum_flex(request,theuser=0, 'promember':promember, }) +@login_required() +def workout_histo_view(request,id=0): + row = Workout.objects.get(id=id) + promember=0 + mayedit=0 + if not request.user.is_anonymous(): + r = Rower.objects.get(user=request.user) + result = request.user.is_authenticated() and r.rowerplan=='pro' + if result: + promember=1 + if request.user == row.user.user: + mayedit=1 + + if not promember: + return HttpResponseRedirect("/rowers/about/") + + + + + res = interactive_histoall([row]) + script = res[0] + div = res[1] + + return render(request, + 'histo_single.html', + {'interactiveplot':script, + 'the_div':div, + 'id':id, + 'mayedit':mayedit, + }) @login_required() def histo(request,theuser=0,