From 16b6bcfb396bb6c38aab0e24ed9091ef78add8aa Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 16 Oct 2018 08:27:36 +0200 Subject: [PATCH] planned sessions --- rowers/templates/plannedsessions.html | 302 +++++++++++--------------- rowers/views.py | 10 +- 2 files changed, 140 insertions(+), 172 deletions(-) diff --git a/rowers/templates/plannedsessions.html b/rowers/templates/plannedsessions.html index 5ee31411..cbff280b 100644 --- a/rowers/templates/plannedsessions.html +++ b/rowers/templates/plannedsessions.html @@ -1,181 +1,137 @@ -{% extends "base.html" %} +{% extends "newbase.html" %} {% load staticfiles %} {% load rowerfilters %} {% block title %}Planned Sessions{% endblock %} -{% block content %} -
- {% include "planningbuttons.html" %} -
-
-

Plan for {{ rower.user.first_name }} {{ rower.user.last_name }}

-
- -{% if user.is_authenticated and user|is_manager %} - -{% endif %} -
- Courses -
-
- {% if plannedsessions %} -

- Click on session name to view, edit to change the session and on the - traffic light symbol to add workouts to the session -

- - - - - - - - - - - - - - - - - - {% for ps in plannedsessions %} - - - - - - - - - - - - {% if completeness|lookup:ps.id == 'partial' %} - +{% block main %} + +

Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}

+ +{% if plannedsessions %} +

+ Click on session name to view, edit to change the session and on the + traffic light symbol to add workouts to the session +

+
StatusOn or AfterOn or BeforeNameTypeModeEditPlannedActual Completion Date -
- {% if completeness|lookup:ps.id == 'not done' %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% elif completeness|lookup:ps.id == 'completed' %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% elif completeness|lookup:ps.id == 'partial' %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% else %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% endif %} - {{ ps.startdate|date:"Y-m-d" }} {{ ps.enddate|date:"Y-m-d" }} - {% if ps.sessiontype != 'race' %} - {% if ps.name != '' %} - {{ ps.name }} - {% else %} - Unnamed Session - {% endif %} - {% else %} - {% if ps.name != '' %} - {{ ps.name }} - {% else %} - Unnamed Race - {% endif %} - {% endif %} - {{ ps.get_sessiontype_display }} {{ ps.get_sessionmode_display }} - {% if ps.manager == request.user %} - Edit - {% else %} -   - {% endif %} - {{ ps.sessionvalue }} {{ actualvalue|lookup:ps.id }} {{ ps.sessionunit }} {{ completiondate|lookup:ps.id|date:"Y-m-d" }}
+ + + + + + + + + + + + + + + + + {% for ps in plannedsessions %} + + +   {% endif %} - - {% endfor %} - -
StatusOn or AfterOn or BeforeNameTypeModeEditPlannedActual Completion Date +
+ {% if completeness|lookup:ps.id == 'not done' %} + {% if ps.sessiontype != 'race' %} + +   {% else %} - {{ completiondate|lookup:ps.id|date:"Y-m-d" }}
- {% else %} - You have no planned workouts for this period. Planned workouts are created - by your coach if you are part of a team. You can create your own - planned workouts by purchasing the "Coach" or "Self-Coach" plans. - {% endif %} -

- Print View -

- {% if unmatchedworkouts %} -

Workouts that are not linked to any session

+ {% elif completeness|lookup:ps.id == 'completed' %} + {% if ps.sessiontype != 'race' %} +   + {% else %} +   + {% endif %} + {% elif completeness|lookup:ps.id == 'partial' %} + {% if ps.sessiontype != 'race' %} +   + {% else %} +   + {% endif %} + {% else %} + {% if ps.sessiontype != 'race' %} +   + {% else %} +   + {% endif %} + {% endif %} + + {{ ps.startdate|date:"Y-m-d" }} + {{ ps.enddate|date:"Y-m-d" }} + + {% if ps.sessiontype != 'race' %} + {% if ps.name != '' %} + {{ ps.name }} + {% else %} + Unnamed Session + {% endif %} + {% else %} + {% if ps.name != '' %} + {{ ps.name }} + {% else %} + Unnamed Race + {% endif %} + {% endif %} + + {{ ps.get_sessiontype_display }} + {{ ps.get_sessionmode_display }} + + {% if ps.manager == request.user %} + Edit + {% else %} +   + {% endif %} + + {{ ps.sessionvalue }} + {{ actualvalue|lookup:ps.id }} + {{ ps.sessionunit }} + {% if completeness|lookup:ps.id == 'partial' %} + {{ completiondate|lookup:ps.id|date:"Y-m-d" }} + {% else %} + {{ completiondate|lookup:ps.id|date:"Y-m-d" }} + {% endif %} + + {% endfor %} + + +{% else %} +You have no planned workouts for this period. Planned workouts are created +by your coach if you are part of a team. You can create your own +planned workouts by purchasing the "Coach" or "Self-Coach" plans. +{% endif %} +

+ + Print View +

+{% if unmatchedworkouts %} +

Workouts that are not linked to any session

+

- - - - - - - - + + + + + + + + @@ -211,12 +167,16 @@ {% endfor %}
Date Time Name Type Distance Duration Avg HR Max HR Date Time Name Type Distance Duration Avg HR Max HR
- + {% endif %} -

+

- +{% endblock %} + + +{% block sidebar %} +{% include 'menu_plan.html' %} {% endblock %} diff --git a/rowers/views.py b/rowers/views.py index 166ebd4a..28a86331 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -14232,10 +14232,17 @@ def plannedsessions_coach_view(request, ) @login_required() -def plannedsessions_view(request,timeperiod='thisweek',userid=0): +def plannedsessions_view(request, + userid=0): r = getrequestrower(request,userid=userid) + when = request.GET.get('when') + if when: + timeperiod = when + else: + timeperiod = 'thisweek' + startdate,enddate = get_dates_timeperiod(timeperiod) try: @@ -14270,6 +14277,7 @@ def plannedsessions_view(request,timeperiod='thisweek',userid=0): 'teams':get_my_teams(request.user), 'plannedsessions':sps, 'plan':trainingplan, + 'active': 'nav-plan', 'rower':r, 'timeperiod':timeperiod, 'completeness':completeness,