From bdf86d73217caff71cc624920e9938052a98984b Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 29 Oct 2018 21:47:58 +0100 Subject: [PATCH 1/2] edit plan --- rowers/templates/trainingplan.html | 10 ++++++---- rowers/templates/trainingplan_create.html | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rowers/templates/trainingplan.html b/rowers/templates/trainingplan.html index 072dd756..84c3ccac 100644 --- a/rowers/templates/trainingplan.html +++ b/rowers/templates/trainingplan.html @@ -70,7 +70,7 @@ {{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }}) - {% if macrocycle.0.type == 'userdefined' %} + {% if macrocycle.0.type == 'userdefined' and macrocycle.0.plan.status %} dist (m) @@ -180,7 +180,7 @@ Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }}) - {% if mesocycle.0.type == 'userdefined' %} + {% if mesocycle.0.type == 'userdefined' and mesoocycle0.plan.plan.status %} dist (m) @@ -259,7 +259,7 @@ {% if todays_date <= microcycle.enddate|date:"Y-m-d" %} - {% if microcycle.plan.type == 'userdefined' %} + {% if microcycle.plan.type == 'userdefined' %}   @@ -276,7 +276,7 @@ {% endif %} {% else %} - {% if microcycle.plan.type == 'userdefined' %} + {% if microcycle.plan.type == 'userdefined' %}   @@ -299,6 +299,7 @@ Micro {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }}) + {% if microcycle.plan.plan.plan.status %} dist (m) @@ -320,6 +321,7 @@ {{ microcycle.actualrscore }} {{ microcycle.actualtrimp }} + {% endif %} {% if todays_date <= microcycle.enddate|date:"Y-m-d" %}   diff --git a/rowers/templates/trainingplan_create.html b/rowers/templates/trainingplan_create.html index 69086bde..76c4d07e 100644 --- a/rowers/templates/trainingplan_create.html +++ b/rowers/templates/trainingplan_create.html @@ -73,13 +73,13 @@ {{ plan.name }} {% if plan.status %} active {% else %} inactive {% endif %} - {% if request.user == plan.manager %} + {% if request.user.rower == plan.manager %} Edit {% endif %} Plan - {% if request.user == plan.manager %} + {% if request.user.rower == plan.manager %} Delete {% endif %} From 840b6c6eab5ce1ef96aa12477bfd904563717801 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 29 Oct 2018 21:55:36 +0100 Subject: [PATCH 2/2] showing actuals only for active plans --- rowers/templates/trainingplan.html | 2 +- rowers/views.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rowers/templates/trainingplan.html b/rowers/templates/trainingplan.html index 84c3ccac..1d29b18e 100644 --- a/rowers/templates/trainingplan.html +++ b/rowers/templates/trainingplan.html @@ -180,7 +180,7 @@ Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }}) - {% if mesocycle.0.type == 'userdefined' and mesoocycle0.plan.plan.status %} + {% if mesocycle.0.type == 'userdefined' and mesocycle.0.plan.plan.status %} dist (m) diff --git a/rowers/views.py b/rowers/views.py index 3fe9813a..cb9e6023 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -16597,8 +16597,6 @@ def rower_trainingplan_view(request, type='userdefined').order_by("startdate") - r = plan.rower - for m in macrocycles: createmesofillers(m) m.plantime = 0 @@ -16631,7 +16629,7 @@ def rower_trainingplan_view(request, for mm in microcycles: sps = PlannedSession.objects.filter( - rower = plan.rower, + rower = r, startdate__lte=mm.enddate, enddate__gte=mm.startdate)