linking back to plan
This commit is contained in:
@@ -1,14 +1,18 @@
|
|||||||
{% load rowerfilters %}
|
{% load rowerfilters %}
|
||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p>
|
<div class="grid_2 dropdown alpha">
|
||||||
{% if timeperiod and rower %}
|
<button class="grid_2 alpha button gray small dropbtn">Overview</button>
|
||||||
<a class="button gray small" href="/rowers/sessions/{{ timeperiod }}/rower/{{ rower.id }}">Plan Overview</a>
|
<div class="dropdown-content">
|
||||||
{% elif timeperiod %}
|
{% if timeperiod and rower %}
|
||||||
<a class="button gray small" href="/rowers/sessions/{{ timeperiod }}">Plan Overview</a>
|
<a class="button gray small" href="/rowers/sessions/{{ timeperiod }}/rower/{{ rower.id }}">Sessions Overview</a>
|
||||||
{% else %}
|
{% elif timeperiod %}
|
||||||
<a class="button gray small" href="/rowers/sessions">Plan Overview</a>
|
<a class="button gray small" href="/rowers/sessions/{{ timeperiod }}">Sessions Overview</a>
|
||||||
{% endif %}
|
{% else %}
|
||||||
</p>
|
<a class="button gray small" href="/rowers/sessions">Sessions Overview</a>
|
||||||
|
{% endif %}
|
||||||
|
<a class="button gray small" href="/rowers/plan/{{ plan.id }}">Plan Overview</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2">
|
<div class="grid_2">
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -20,16 +20,6 @@
|
|||||||
<h1>Training Plan - {{ plan.name }}</h1>
|
<h1>Training Plan - {{ plan.name }}</h1>
|
||||||
<p>This plan starts on {{ plan.startdate }} and ends on {{ plan.enddate }}. The training plan target is: {{ plan.target.name }} on {{ plan.target.date }}.</p>
|
<p>This plan starts on {{ plan.startdate }} and ends on {{ plan.enddate }}. The training plan target is: {{ plan.target.name }} on {{ plan.target.date }}.</p>
|
||||||
<p><a href="/rowers/editplan/{{ plan.id }}">Edit the plan</a></p>
|
<p><a href="/rowers/editplan/{{ plan.id }}">Edit the plan</a></p>
|
||||||
<p>Click on the plan cycles below 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.</p>
|
|
||||||
<p>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.</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_4 alpha">
|
<div class="grid_4 alpha">
|
||||||
<h2>Macro Cycles</h2>
|
<h2>Macro Cycles</h2>
|
||||||
@@ -55,7 +45,12 @@
|
|||||||
{% if todays_date <= macrocycle.0.enddate|date:"Y-m-d" %}
|
{% if todays_date <= macrocycle.0.enddate|date:"Y-m-d" %}
|
||||||
<p><a href="/rowers/macrocycle/{{ macrocycle.0.id }}">edit</a>
|
<p><a href="/rowers/macrocycle/{{ macrocycle.0.id }}">edit</a>
|
||||||
/
|
/
|
||||||
<a href="/rowers/deletemacrocycle/{{ macrocycle.0.id }}">delete</a></p>
|
<a href="/rowers/deletemacrocycle/{{ macrocycle.0.id }}">delete</a>
|
||||||
|
/
|
||||||
|
<a href='/rowers/sessions/{{ macrocycle.0.startdate|date:"Y-m-d" }}/{{ macrocycle.0.enddate|date:"Y-m-d" }}'>sessions</a>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
<p> </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -72,8 +67,14 @@
|
|||||||
{% if todays_date <= mesocycle.0.enddate|date:"Y-m-d" %}
|
{% if todays_date <= mesocycle.0.enddate|date:"Y-m-d" %}
|
||||||
<p><a href="/rowers/mesocycle/{{ mesocycle.0.id }}">edit</a>
|
<p><a href="/rowers/mesocycle/{{ mesocycle.0.id }}">edit</a>
|
||||||
/
|
/
|
||||||
<a href="/rowers/deletemesocycle/{{ mesocycle.0.id }}">delete</a></p>
|
<a href="/rowers/deletemesocycle/{{ mesocycle.0.id }}">delete</a>
|
||||||
|
/
|
||||||
|
<a href='/rowers/sessions/{{ mesocycle.0.startdate|date:"Y-m-d" }}/{{ mesocycle.0.enddate|date:"Y-m-d" }}'>sessions</a>
|
||||||
|
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<p> </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,8 +92,13 @@
|
|||||||
<p>
|
<p>
|
||||||
<a href="/rowers/microcycle/{{ microcycle.id }}">edit</a>
|
<a href="/rowers/microcycle/{{ microcycle.id }}">edit</a>
|
||||||
/
|
/
|
||||||
<a href="/rowers/deletemicrocycle/{{ microcycle.id }}">delete</a></p>
|
<a href="/rowers/deletemicrocycle/{{ microcycle.id }}">delete</a>
|
||||||
|
/
|
||||||
|
<a href='/rowers/sessions/{{ microcycle.startdate|date:"Y-m-d" }}/{{ microcycle.enddate|date:"Y-m-d" }}'>sessions</a>
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<p> </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,5 +108,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid_12">
|
||||||
|
<p>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.</p>
|
||||||
|
<p>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.</p>
|
||||||
|
<p>Click on "Sessions" in the cycle of your interest to see details
|
||||||
|
of the individual training sessions planned for this period.</p>
|
||||||
|
<p>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.</p>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -12483,6 +12483,7 @@ def plannedsession_multiclone_view(
|
|||||||
def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0):
|
def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0):
|
||||||
|
|
||||||
r = getrequestrower(request,rowerid=rowerid)
|
r = getrequestrower(request,rowerid=rowerid)
|
||||||
|
startdate,enddate = get_dates_timeperiod(timeperiod)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
sessioncreateform = PlannedSessionForm(request.POST)
|
sessioncreateform = PlannedSessionForm(request.POST)
|
||||||
@@ -12539,26 +12540,46 @@ def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0):
|
|||||||
fstartdate = arrow.get(request.session['fstartdate']).date()
|
fstartdate = arrow.get(request.session['fstartdate']).date()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
fstartdate = timezone.now().date()
|
fstartdate = timezone.now().date()
|
||||||
|
if fstartdate < startdate:
|
||||||
|
fstartdate = startdate
|
||||||
try:
|
try:
|
||||||
fenddate = arrow.get(request.session['fenddate']).date()
|
fenddate = arrow.get(request.session['fenddate']).date()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
fenddate = timezone.now().date()
|
fenddate = timezone.now().date()
|
||||||
|
if fenddate > enddate:
|
||||||
|
fenddate = enddate
|
||||||
try:
|
try:
|
||||||
fprefdate = arrow.get(request.session['fprefdate']).date()
|
fprefdate = arrow.get(request.session['fprefdate']).date()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
fprefdate = timezone.now().date()
|
fprefdate = timezone.now().date()
|
||||||
|
|
||||||
|
if fprefdate < startdate:
|
||||||
|
fprefdate = startdate
|
||||||
|
|
||||||
|
if fprefdate > enddate:
|
||||||
|
fprefdate = enddate
|
||||||
|
|
||||||
forminitial = {
|
forminitial = {
|
||||||
'startdate':fstartdate,
|
'startdate':fstartdate,
|
||||||
'enddate':fenddate,
|
'enddate':fenddate,
|
||||||
'preferreddate':fprefdate
|
'preferreddate':fprefdate
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
forminitial = {}
|
preferreddate = startdate
|
||||||
|
if preferreddate < timezone.now().date():
|
||||||
|
preferreddate = timezone.now().date()
|
||||||
|
|
||||||
|
if preferreddate > enddate:
|
||||||
|
preferreddate = enddate
|
||||||
|
|
||||||
|
forminitial = {
|
||||||
|
'startdate':startdate,
|
||||||
|
'enddate':enddate,
|
||||||
|
'preferreddate':preferreddate,
|
||||||
|
}
|
||||||
|
|
||||||
sessioncreateform = PlannedSessionForm(initial=forminitial)
|
sessioncreateform = PlannedSessionForm(initial=forminitial)
|
||||||
|
|
||||||
startdate,enddate = get_dates_timeperiod(timeperiod)
|
|
||||||
sps = get_sessions(r,startdate=startdate,enddate=enddate)
|
sps = get_sessions(r,startdate=startdate,enddate=enddate)
|
||||||
|
|
||||||
return render(request,'plannedsessioncreate.html',
|
return render(request,'plannedsessioncreate.html',
|
||||||
@@ -12943,7 +12964,15 @@ def plannedsessions_view(request,timeperiod='thisweek',rowerid=0):
|
|||||||
r = getrequestrower(request,rowerid=rowerid)
|
r = getrequestrower(request,rowerid=rowerid)
|
||||||
|
|
||||||
startdate,enddate = get_dates_timeperiod(timeperiod)
|
startdate,enddate = get_dates_timeperiod(timeperiod)
|
||||||
|
|
||||||
|
try:
|
||||||
|
trainingplan = TrainingPlan.objects.filter(
|
||||||
|
startdate__lte = startdate,
|
||||||
|
enddate__gte = enddate)[0]
|
||||||
|
except IndexError:
|
||||||
|
trainingplan = None
|
||||||
|
|
||||||
|
|
||||||
sps = get_sessions(r,startdate=startdate,enddate=enddate)
|
sps = get_sessions(r,startdate=startdate,enddate=enddate)
|
||||||
|
|
||||||
completeness = {}
|
completeness = {}
|
||||||
@@ -12966,6 +12995,7 @@ def plannedsessions_view(request,timeperiod='thisweek',rowerid=0):
|
|||||||
{
|
{
|
||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
'plannedsessions':sps,
|
'plannedsessions':sps,
|
||||||
|
'plan':trainingplan,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'timeperiod':timeperiod,
|
'timeperiod':timeperiod,
|
||||||
'completeness':completeness,
|
'completeness':completeness,
|
||||||
@@ -13120,6 +13150,7 @@ def plannedsessions_manage_view(request,timeperiod='thisweek',rowerid=0,
|
|||||||
|
|
||||||
|
|
||||||
# Clone an existing planned session
|
# Clone an existing planned session
|
||||||
|
# need clarity on cloning behavior time shift
|
||||||
@user_passes_test(hasplannedsessions,login_url="/rowers/planmembership/",
|
@user_passes_test(hasplannedsessions,login_url="/rowers/planmembership/",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
def plannedsession_clone_view(request,id=0,rowerid=0,
|
def plannedsession_clone_view(request,id=0,rowerid=0,
|
||||||
@@ -13146,8 +13177,9 @@ def plannedsession_clone_view(request,id=0,rowerid=0,
|
|||||||
|
|
||||||
ps.startdate = timezone.now().date()
|
ps.startdate = timezone.now().date()
|
||||||
ps.enddate = (timezone.now()+deltadays).date()
|
ps.enddate = (timezone.now()+deltadays).date()
|
||||||
|
ps.preferreddate = ps.preferreddate+deltadays
|
||||||
ps.name += ' (copy)'
|
ps.name += ' (copy)'
|
||||||
|
|
||||||
ps.save()
|
ps.save()
|
||||||
|
|
||||||
for rower in rowers:
|
for rower in rowers:
|
||||||
|
|||||||
Reference in New Issue
Block a user