diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 1053c855..a17c74f0 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1043,18 +1043,18 @@ def interactive_cum_flex_chart2(theworkouts,promember=0, # test if we have drive energy nowork = 1 try: - test = rowdata['driveenergy'].mean() + test = datadf['driveenergy'].mean() nowork = 0 except KeyError: - rowdata['driveenergy'] = 500. + datadf['driveenergy'] = 500. # test if we have power nopower = 1 try: - test = rowdata['power'].mean() + test = datadf['power'].mean() nopower = 0 except KeyError: - rowdata['power'] = 50. + datadf['power'] = 50. yparamname1 = axlabels[yparam1] diff --git a/rowers/templates/cum_flex.html b/rowers/templates/cum_flex.html index 22acd20a..4d712ba2 100644 --- a/rowers/templates/cum_flex.html +++ b/rowers/templates/cum_flex.html @@ -24,7 +24,28 @@
-

Stroke Analysis

+
+ {% if theuser %} +

{{ theuser.first_name }}'s Stroke Analysis

+ {% else %} +

{{ user.first_name }}'s Stroke Analysis

+ {% endif %} +
+
+ {% if user.is_authenticated and user|is_manager %} +
diff --git a/rowers/templates/cumstats.html b/rowers/templates/cumstats.html index 7d814c62..84d41d5c 100644 --- a/rowers/templates/cumstats.html +++ b/rowers/templates/cumstats.html @@ -35,11 +35,28 @@
-

Workout Statistics

-

- This is an experimental page which just lists a bunch of statistics for - your workouts. This page is under rapid development. -

+
+ {% if theuser %} +

{{ theuser.first_name }}'s Workout Statistics

+ {% else %} +

{{ user.first_name }}'s Workout Statistics

+ {% endif %} +
+
+ {% if user.is_authenticated and user|is_manager %} +
diff --git a/rowers/templates/histo.html b/rowers/templates/histo.html index 8fa50f6f..fe9b1024 100644 --- a/rowers/templates/histo.html +++ b/rowers/templates/histo.html @@ -35,7 +35,28 @@
-

Indoor Rower Power Histogram

+
+ {% if theuser %} +

{{ theuser.first_name }}'s Indoor Rower Power Histogram

+ {% else %} +

{{ user.first_name }}'s Indoor Rower Power Histogram

+ {% endif %} +
+
+ {% if user.is_authenticated and user|is_manager %} +
diff --git a/rowers/templates/rankings.html b/rowers/templates/rankings.html index 441961d3..dc3ac9a6 100644 --- a/rowers/templates/rankings.html +++ b/rowers/templates/rankings.html @@ -35,7 +35,28 @@
-

Ranking Pieces (Indoor Rower)

+
+ {% if theuser %} +

{{ theuser.first_name }}'s Ranking Pieces

+ {% else %} +

{{ user.first_name }}'s Ranking Pieces

+ {% endif %} +
+
+ {% if user.is_authenticated and user|is_manager %} +
diff --git a/rowers/templates/user_boxplot_select.html b/rowers/templates/user_boxplot_select.html index e5e5c611..923ceb84 100644 --- a/rowers/templates/user_boxplot_select.html +++ b/rowers/templates/user_boxplot_select.html @@ -13,11 +13,28 @@
- {% if theuser %} -

{{ theuser.first_name }}'s Workouts

- {% else %} -

{{ user.first_name }}'s Workouts

- {% endif %} +
+ {% if theuser %} +

{{ theuser.first_name }}'s Workouts

+ {% else %} +

{{ user.first_name }}'s Workouts

+ {% endif %} +
+
+ {% if user.is_authenticated and user|is_manager %} +
diff --git a/rowers/templatetags/rowerfilters.py b/rowers/templatetags/rowerfilters.py index 31dc8a04..840d74d4 100644 --- a/rowers/templatetags/rowerfilters.py +++ b/rowers/templatetags/rowerfilters.py @@ -125,3 +125,17 @@ def has_teams(user): return False return False + +@register.filter +def team_members(user): + try: + therower = Rower.objects.get(user=user) + if therower.rowerplan != 'coach': + return [] + teams = Team.objects.filter(manager=user) + members = Rower.objects.filter(team__in=teams) + return [rower.user for rower in members] + except TypeError: + return [] + + return [] diff --git a/rowers/urls.py b/rowers/urls.py index d7b8f857..7d63ecb1 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -124,7 +124,7 @@ urlpatterns = [ url(r'^team-compare-select/team/(?P\d+)/$',views.team_comparison_select), url(r'^team-compare-select/(?P\w+.*)/(?P\w+.*)$',views.team_comparison_select), url(r'^team-compare-select/$',views.team_comparison_select), - url(r'^user-boxplot-select/team/(?P\d+)/(?P\w+.*)/(?P\w+.*)$',views.user_boxplot_select), + url(r'^user-boxplot-select/user/(?P\d+)/(?P\w+.*)/(?P\w+.*)$',views.user_boxplot_select), url(r'^user-boxplot-select/user/(?P\d+)/$',views.user_boxplot_select), url(r'^user-boxplot-select/(?P\w+.*)/(?P\w+.*)$',views.user_boxplot_select), url(r'^user-boxplot-select/$',views.user_boxplot_select), @@ -135,7 +135,7 @@ urlpatterns = [ url(r'^ote-bests/(?P\d+)$',views.rankings_view), url(r'^ote-bests/$',views.rankings_view), url(r'^(?P\d+)/ote-bests/$',views.rankings_view), - + url(r'^(?P\d+)/flexall/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)$',views.cum_flex), url(r'^flexall/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)$',views.cum_flex), url(r'^flexall/(?P\w+.*)/(?P\w+.*)/(?P\w+.*)$',views.cum_flex), url(r'^flexall/$',views.cum_flex),