making execution chart accessible
This commit is contained in:
@@ -178,7 +178,11 @@ def get_execution_report(rower,startdate,enddate,plan=None):
|
|||||||
macros = TrainingMacroCycle.objects.filter(plan=plan).order_by("startdate")
|
macros = TrainingMacroCycle.objects.filter(plan=plan).order_by("startdate")
|
||||||
checkscores(rower,macros)
|
checkscores(rower,macros)
|
||||||
mesos = TrainingMesoCycle.objects.filter(plan__in=macros).order_by("startdate")
|
mesos = TrainingMesoCycle.objects.filter(plan__in=macros).order_by("startdate")
|
||||||
micros = TrainingMicroCycle.objects.filter(plan__in=mesos).order_by("startdate")
|
micros = TrainingMicroCycle.objects.filter(
|
||||||
|
plan__in=mesos,
|
||||||
|
enddate__gte=startdate,
|
||||||
|
startdate__lte=enddate,
|
||||||
|
).order_by("startdate")
|
||||||
|
|
||||||
# we've got micros, now get sessions
|
# we've got micros, now get sessions
|
||||||
startdates = []
|
startdates = []
|
||||||
@@ -203,7 +207,7 @@ def get_execution_report(rower,startdate,enddate,plan=None):
|
|||||||
actualscore += minutes
|
actualscore += minutes
|
||||||
for ps in sps:
|
for ps in sps:
|
||||||
ratio, status, cdate = is_session_complete(rower,ps)
|
ratio, status, cdate = is_session_complete(rower,ps)
|
||||||
if ps.sessionmode == 'rscore':
|
if ps.sessionmode == 'rScore':
|
||||||
plannedscore += ps.sessionvalue
|
plannedscore += ps.sessionvalue
|
||||||
actualscore += ratio*ps.sessionvalue
|
actualscore += ratio*ps.sessionvalue
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -122,6 +122,11 @@
|
|||||||
<a
|
<a
|
||||||
href="/rowers/sessions/sendcalendar/user/{{ rower.user.id }}/?when={{ timeperiod }}">
|
href="/rowers/sessions/sendcalendar/user/{{ rower.user.id }}/?when={{ timeperiod }}">
|
||||||
Get Calendar File</a>
|
Get Calendar File</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="/rowers/plan/0/execution/?when={{ timeperiod }}/">
|
||||||
|
Actual vs Plan chart
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
{% if plan|mayeditplan:request %}
|
{% if plan|mayeditplan:request %}
|
||||||
<p><a href="/rowers/editplan/{{ plan.id }}">Edit the plan</a></p>
|
<p><a href="/rowers/editplan/{{ plan.id }}">Edit the plan</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<p><a href="/rowers/plan/{{ plan.id }}/execution/">Plan vs Actual chart</a></p>
|
||||||
|
|
||||||
<h2>Plan Macro, Meso and Micro Cycles</h2>
|
<h2>Plan Macro, Meso and Micro Cycles</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -2336,13 +2336,12 @@ def rower_trainingplan_execution_view(request,
|
|||||||
id=0,
|
id=0,
|
||||||
userid=0):
|
userid=0):
|
||||||
|
|
||||||
startdate = request.GET.get('startdate')
|
startdate,enddate = get_dates_timeperiod(request)
|
||||||
enddate = request.GET.get('enddate')
|
|
||||||
|
|
||||||
r = getrequestrower(request,userid=userid)
|
r = getrequestrower(request,userid=userid)
|
||||||
|
|
||||||
|
|
||||||
if int(id):
|
if int(id)>0:
|
||||||
try:
|
try:
|
||||||
plan = TrainingPlan.objects.get(id=id)
|
plan = TrainingPlan.objects.get(id=id)
|
||||||
except TrainingPlan.DoesNotExist:
|
except TrainingPlan.DoesNotExist:
|
||||||
@@ -2352,7 +2351,7 @@ def rower_trainingplan_execution_view(request,
|
|||||||
raise PermissionDenied("Access denied")
|
raise PermissionDenied("Access denied")
|
||||||
|
|
||||||
if not startdate or not enddate:
|
if not startdate or not enddate:
|
||||||
if int(id):
|
if int(id)>0:
|
||||||
startdate = plan.startdate
|
startdate = plan.startdate
|
||||||
enddate = plan.enddate
|
enddate = plan.enddate
|
||||||
else:
|
else:
|
||||||
@@ -2361,7 +2360,7 @@ def rower_trainingplan_execution_view(request,
|
|||||||
startdate,enddate = get_dates_timeperiod(request)
|
startdate,enddate = get_dates_timeperiod(request)
|
||||||
|
|
||||||
|
|
||||||
if int(id):
|
if int(id)>0:
|
||||||
data,message = get_execution_report(r,startdate,enddate,plan=plan)
|
data,message = get_execution_report(r,startdate,enddate,plan=plan)
|
||||||
else:
|
else:
|
||||||
data,message = get_execution_report(r,startdate,enddate)
|
data,message = get_execution_report(r,startdate,enddate)
|
||||||
|
|||||||
Reference in New Issue
Block a user