diff --git a/rowers/templates/trainingplan.html b/rowers/templates/trainingplan.html index 721d6539..8a54c518 100644 --- a/rowers/templates/trainingplan.html +++ b/rowers/templates/trainingplan.html @@ -9,12 +9,6 @@ {% endblock %} {% block content %} - -

Training Plan - {{ plan.name }}

@@ -31,75 +25,29 @@

Micro Cycles

+ +
{% now "Y-m-d" as todays_date %} + {% for key,macrocycle in cycles.items %} +
+ {% if macrocycle.0.type == 'filler' %}
- {% else %} -
- {% endif %} -
- - - - - - - - - - - - - - - - - - - - - - - - - - {% if todays_date <= macrocycle.0.enddate|date:"Y-m-d" %} - - - - - - - {% endif %} -
- {{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }}) -
dist (m)t (min)rScoreTRIMP
plan{{ macrocycle.0.plandistance }}{{ macrocycle.0.plantime }}{{ maccrocycle.0.planrscore }}{{ macrocycle.0.plantrimp }}
actual{{ macrocycle.0.actualdistance }}{{ macrocycle.0.actualtime }}{{ macrocycle.0.actualrscore }}{{ macrocycle.0.actualtrimp }}
 
- edit - / - delete - / - sessions -
-
-
-
- {% for key, mesocycle in macrocycle.1.items %} - {% if mesocycle.0.type == 'filler' %} -
- {% else %} -
- {% endif %} + {% else %} +
+ {% endif %} +
- {% if mesocycle.0.plan.type == 'userdefined' %} + {% if macrocycle.0.type == 'userdefined' %} @@ -109,51 +57,59 @@ - - - - + + + + - - - - + + + + + + {% endif %} + {% if todays_date <= macrocycle.0.enddate|date:"Y-m-d" %} + + - {% if todays_date <= mesocycle.0.enddate|date:"Y-m-d" %} - - - {% endif %} - {% endif %} -
- {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }}) + {{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }})
dist (m)
plan{{ mesocycle.0.plandistance }}{{ mesocycle.0.plantime }}{{ mesocycle.0.planrscore }}{{ mesocycle.0.plantrimp }}{{ macrocycle.0.plandistance }}{{ macrocycle.0.plantime }}{{ maccrocycle.0.planrscore }}{{ macrocycle.0.plantrimp }}
actual{{ mesocycle.0.actualdistance }}{{ mesocycle.0.actualtime }}{{ mesocycle.0.actualrscore }}{{ mesocycle.0.actualtrimp }}{{ macrocycle.0.actualdistance }}{{ macrocycle.0.actualtime }}{{ macrocycle.0.actualrscore }}{{ macrocycle.0.actualtrimp }}
 
 
- edit + edit / - delete + delete / - sessions + sessions
+
+
-
- {% for microcycle in mesocycle.1 %} - {% if microcycle.type == 'filler' %} -
- {% else %} -
- {% endif %} -
+ + +
+ + {% for key, mesocycle in macrocycle.1.items %} + +
+ + {% if mesocycle.0.type == 'filler' %} +
+ {% else %} +
+ {% endif %} + +
- {% if microcycle.plan.type == 'userdefined' %} + {% if mesocycle.0.type == 'userdefined' %} @@ -163,59 +119,141 @@ - - - - + + + + - - - - + + + + + + {% endif %} + {% if todays_date <= mesocycle.0.enddate|date:"Y-m-d" %} + {% if mesocycle.0.plan.type == 'userdefined' %} + + - {% if todays_date <= microcycle.enddate|date:"Y-m-d" %} - - - {% endif %} {% endif %}
- {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }}) + {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }})
dist (m)
plan{{ microcycle.plandistance }}{{ microcycle.plantime }}{{ microcycle.planrscore }}{{ microcycle.plantrimp }}{{ mesocycle.0.plandistance }}{{ mesocycle.0.plantime }}{{ mesocycle.0.planrscore }}{{ mesocycle.0.plantrimp }}
actual{{ microcycle.actualdistance }}{{ microcycle.actualtime }}{{ microcycle.actualrscore }}{{ microcycle.actualtrimp }}{{ mesocycle.0.actualdistance }}{{ mesocycle.0.actualtime }}{{ mesocycle.0.actualrscore }}{{ mesocycle.0.actualtrimp }}
 
 
- edit + edit / - delete + delete / - sessions + sessions
+
- {% endfor %} + + +
+ + {% for microcycle in mesocycle.1 %} + + {% if microcycle.type == 'filler' %} +
+ {% else %} +
+ {% endif %} + +
+ + + + + {% if microcycle.type == 'userdefined' %} + + + + + + + + + + + + + + + + + + + + + + {% endif %} + {% if todays_date <= microcycle.enddate|date:"Y-m-d" %} + {% if microcycle.plan.type == 'userdefined' %} + + + + + + + {% endif %} + {% endif %} +
+ {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }}) +
dist (m)t (min)rScoreTRIMP
plan{{ microcycle.plandistance }}{{ microcycle.plantime }}{{ microcycle.planrscore }}{{ microcycle.plantrimp }}
actual{{ microcycle.actualdistance }}{{ microcycle.actualtime }}{{ microcycle.actualrscore }}{{ microcycle.actualtrimp }}
 
+ edit + / + delete + / + sessions +
+
+ +
+ + {% endfor %} +
+ +
+ {% endfor %} +
-
- {% endfor %} -
-
-

Click on the plan cycles to edit their names, start and end dates. The gray "filler" - cycles are generated, adjusted and deleted automatically to ensure the entire plan - duration is covered with non-overlapping cycles. - Once you edit a filler cycle, it become a user-defined cycle, which cannot be deleted - by the system.

-

Filler cycles which have a filler cycle as a parent cannot be edited - or deleted. You have to edit the parent cycle first. The reason is - that children of filler cycles are not safe. They are deleted when - their parent is deleted by the system.

-

Click on "Sessions" in the cycle of your interest to see details - of the individual training sessions planned for this period.

-

A good way to organize the plan is to think of micro cycles as training weeks. Macro cycles - are typically used to address specific phases of preparation and to indicate the racing - season and may span several months. - Meso cycles can be used to group sequences of three to five light, medium and - hard weeks. It is recommended to work from left to right, starting with the macro cycles.

+ +
+ + {% endfor %} + +
+ +
+

Click on the plan cycles to edit their names, start and end dates. + The gray "filler" + cycles are generated, adjusted and deleted automatically to + ensure the entire plan + duration is covered with non-overlapping cycles. + Once you edit a filler cycle, it become a user-defined + cycle, which cannot be deleted + by the system.

+

Filler cycles which have a filler cycle as a parent cannot be edited + or deleted. You have to edit the parent cycle first. The reason is + that children of filler cycles are not safe. They are deleted when + their parent is deleted by the system.

+

Click on "Sessions" in the cycle of your interest to see details + of the individual training sessions planned for this period.

+

A good way to organize the plan is to think of micro + cycles as training weeks. Macro cycles + are typically used to address specific phases of preparation + and to indicate the racing + season and may span several months. + Meso cycles can be used to group sequences of three to five + light, medium and + hard weeks. It is recommended to work from left to right, + starting with the macro cycles.

- {% endblock %} +{% endblock %} diff --git a/rowers/templates/trainingplan2.html b/rowers/templates/trainingplan2.html new file mode 100644 index 00000000..8a54c518 --- /dev/null +++ b/rowers/templates/trainingplan2.html @@ -0,0 +1,259 @@ +{% extends "base.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}Rowsandall Training Plans{% endblock %} + +{% block scripts %} + +{% endblock %} + +{% block content %} +
+
+

Training Plan - {{ plan.name }}

+

This plan starts on {{ plan.startdate }} and ends on {{ plan.enddate }}. The training plan target is: {{ plan.target.name }} on {{ plan.target.date }}.

+

Edit the plan

+
+
+

Macro Cycles

+
+
+

Meso Cycles

+
+
+

Micro Cycles

+
+
+ + +
+ {% now "Y-m-d" as todays_date %} + + {% for key,macrocycle in cycles.items %} + +
+ + {% if macrocycle.0.type == 'filler' %} +
+ {% else %} +
+ {% endif %} + +
+ + + + + {% if macrocycle.0.type == 'userdefined' %} + + + + + + + + + + + + + + + + + + + + + + {% endif %} + {% if todays_date <= macrocycle.0.enddate|date:"Y-m-d" %} + + + + + + + {% endif %} +
+ {{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }}) +
dist (m)t (min)rScoreTRIMP
plan{{ macrocycle.0.plandistance }}{{ macrocycle.0.plantime }}{{ maccrocycle.0.planrscore }}{{ macrocycle.0.plantrimp }}
actual{{ macrocycle.0.actualdistance }}{{ macrocycle.0.actualtime }}{{ macrocycle.0.actualrscore }}{{ macrocycle.0.actualtrimp }}
 
+ edit + / + delete + / + sessions +
+
+ +
+ + +
+ + {% for key, mesocycle in macrocycle.1.items %} + +
+ + {% if mesocycle.0.type == 'filler' %} +
+ {% else %} +
+ {% endif %} + +
+ + + + + {% if mesocycle.0.type == 'userdefined' %} + + + + + + + + + + + + + + + + + + + + + + {% endif %} + {% if todays_date <= mesocycle.0.enddate|date:"Y-m-d" %} + {% if mesocycle.0.plan.type == 'userdefined' %} + + + + + + + {% endif %} + {% endif %} +
+ {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }}) +
dist (m)t (min)rScoreTRIMP
plan{{ mesocycle.0.plandistance }}{{ mesocycle.0.plantime }}{{ mesocycle.0.planrscore }}{{ mesocycle.0.plantrimp }}
actual{{ mesocycle.0.actualdistance }}{{ mesocycle.0.actualtime }}{{ mesocycle.0.actualrscore }}{{ mesocycle.0.actualtrimp }}
 
+ edit + / + delete + / + sessions +
+
+ +
+ + +
+ + {% for microcycle in mesocycle.1 %} + + {% if microcycle.type == 'filler' %} +
+ {% else %} +
+ {% endif %} + +
+ + + + + {% if microcycle.type == 'userdefined' %} + + + + + + + + + + + + + + + + + + + + + + {% endif %} + {% if todays_date <= microcycle.enddate|date:"Y-m-d" %} + {% if microcycle.plan.type == 'userdefined' %} + + + + + + + {% endif %} + {% endif %} +
+ {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }}) +
dist (m)t (min)rScoreTRIMP
plan{{ microcycle.plandistance }}{{ microcycle.plantime }}{{ microcycle.planrscore }}{{ microcycle.plantrimp }}
actual{{ microcycle.actualdistance }}{{ microcycle.actualtime }}{{ microcycle.actualrscore }}{{ microcycle.actualtrimp }}
 
+ edit + / + delete + / + sessions +
+
+ +
+ + {% endfor %} + +
+ +
+ + {% endfor %} + +
+ +
+ + {% endfor %} + +
+ +
+

Click on the plan cycles to edit their names, start and end dates. + The gray "filler" + cycles are generated, adjusted and deleted automatically to + ensure the entire plan + duration is covered with non-overlapping cycles. + Once you edit a filler cycle, it become a user-defined + cycle, which cannot be deleted + by the system.

+

Filler cycles which have a filler cycle as a parent cannot be edited + or deleted. You have to edit the parent cycle first. The reason is + that children of filler cycles are not safe. They are deleted when + their parent is deleted by the system.

+

Click on "Sessions" in the cycle of your interest to see details + of the individual training sessions planned for this period.

+

A good way to organize the plan is to think of micro + cycles as training weeks. Macro cycles + are typically used to address specific phases of preparation + and to indicate the racing + season and may span several months. + Meso cycles can be used to group sequences of three to five + light, medium and + hard weeks. It is recommended to work from left to right, + starting with the macro cycles.

+
+{% endblock %} diff --git a/rowers/views.py b/rowers/views.py index 4f80455c..72a2ea17 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -14416,7 +14416,7 @@ class TrainingPlanDelete(DeleteView): def get_object(self, *args, **kwargs): obj = super(TrainingPlanDelete, self).get_object(*args, **kwargs) - if not checkaccessuser(self.request.user,obj.plan.rower): + if not checkaccessuser(self.request.user,obj.rower): raise PermissionDenied('You are not allowed to delete this training plan') return obj @@ -14493,7 +14493,9 @@ def rower_trainingplan_view(request,id=0): raise PermissionDenied("Access denied") createmacrofillers(plan) - macrocycles = TrainingMacroCycle.objects.filter(plan=plan).order_by("startdate") + macrocycles = TrainingMacroCycle.objects.filter( + plan=plan, + type='userdefined').order_by("startdate") r = plan.rower @@ -14510,10 +14512,11 @@ def rower_trainingplan_view(request,id=0): m.actualtrimp = 0 - mesocycles = TrainingMesoCycle.objects.filter(plan=m).order_by("startdate") + mesocycles = TrainingMesoCycle.objects.filter( + plan=m, + type='userdefined').order_by("startdate") for me in mesocycles: - createmicrofillers(me) me.plantime = 0 me.actualtime = 0 me.plandistance = 0 @@ -14523,7 +14526,9 @@ def rower_trainingplan_view(request,id=0): me.plantrimp = 0 me.actualtrimp = 0 - microcycles = TrainingMicroCycle.objects.filter(plan=me).order_by("startdate") + microcycles = TrainingMicroCycle.objects.filter( + plan=me, + type='userdefined').order_by("startdate") for mm in microcycles: sps = PlannedSession.objects.filter(