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