Private
Public Access
1
0

planned sessions

This commit is contained in:
Sander Roosendaal
2018-10-16 08:27:36 +02:00
parent 328070df52
commit 16b6bcfb39
2 changed files with 140 additions and 172 deletions

View File

@@ -1,181 +1,137 @@
{% extends "base.html" %} {% extends "newbase.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load rowerfilters %} {% load rowerfilters %}
{% block title %}Planned Sessions{% endblock %} {% block title %}Planned Sessions{% endblock %}
{% block content %} {% block main %}
<div class="grid_12 alpha">
{% include "planningbuttons.html" %} <h1>Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
</div>
<div class="grid_6 alpha"> {% if plannedsessions %}
<h1>Plan for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1> <p>
</div> Click on session name to view, edit to change the session and on the
<div id="timeperiod" class="grid_2 dropdown"> traffic light symbol to add workouts to the session
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button> </p>
<div class="dropdown-content"> <table width="90%" class="listtable shortpadded">
<a class="button gray small alpha" <thead>
href="/rowers/sessions/today/rower/{{ rower.id }}"> <tr>
Today <th align="left">Status</th>
</a> <th align="left">On or After</th>
<a class="button gray small alpha" <th align="left">On or Before</th>
href="/rowers/sessions/thisweek/rower/{{ rower.id }}"> <th align="left">Name</th>
This Week <th align="left">Type</th>
</a> <th align="left">Mode</th>
<a class="button gray small alpha" <th align="left">Edit</th>
href="/rowers/sessions/thismonth/rower/{{ rower.id }}"> <th align="left">Planned</th>
This Month <th align="left">Actual</th>
</a> <th align="left">&nbsp;</th>
<a class="button gray small alpha" <th align="left">Completion Date</th>
href="/rowers/sessions/lastweek/rower/{{ rower.id }}"> <th align="left">
Last Week </tr>
</a> </thead>
<a class="button gray small alpha" <tbody>
href="/rowers/sessions/lastmonth/rower/{{ rower.id }}"> {% for ps in plannedsessions %}
Last Month <tr>
</a> <td>
<a class="button gray small alpha" {% if completeness|lookup:ps.id == 'not done' %}
href="/rowers/sessions/nextweek/rower/{{ rower.id }}"> {% if ps.sessiontype != 'race' %}
Next Week <a class="white dot"
</a> href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}/?when={{ timeperiod }}">
<a class="button gray small alpha" &nbsp;</a>
href="/rowers/sessions/nextmonth/rower/{{ rower.id }}">
Next Month
</a>
</div>
</div>
{% if user.is_authenticated and user|is_manager %}
<div class="grid_2 dropdown">
<button class="grid_2 alpha button green small dropbtn">
{{ rower.user.first_name }} {{ rower.user.last_name }}
</button>
<div class="dropdown-content">
{% for member in user|team_rowers %}
<a class="button green small" href="/rowers/sessions/{{ timeperiod }}/rower/{{ member.id }}">{{ member.user.first_name }} {{ member.user.last_name }}</a>
{% endfor %}
</div>
</div>
{% endif %}
<div class="grid_2 omega">
<a class="button small gray" href="/rowers/list-courses">Courses</a>
</div>
<div class="grid_12 alpha">
{% if plannedsessions %}
<p>
Click on session name to view, edit to change the session and on the
traffic light symbol to add workouts to the session
</p>
<table width="90%" class="listtable shortpadded">
<thead>
<tr>
<th>Status</th>
<th>On or After</th>
<th>On or Before</th>
<th>Name</th>
<th>Type</th>
<th>Mode</th>
<th>Edit</th>
<th>Planned</th>
<th>Actual</th>
<th>&nbsp;</th>
<th>Completion Date</th>
<th>
</tr>
</thead>
<tbody>
{% for ps in plannedsessions %}
<tr>
<td>
{% if completeness|lookup:ps.id == 'not done' %}
{% if ps.sessiontype != 'race' %}
<a class="white dot" href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ rower.id }}/session/{{ ps.id }}">&nbsp;</a>
{% else %}
<a class="white dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
{% endif %}
{% elif completeness|lookup:ps.id == 'completed' %}
{% if ps.sessiontype != 'race' %}
<a class="green dot" href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ rower.id }}/session/{{ ps.id }}">&nbsp;</a>
{% else %}
<a class="green dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
{% endif %}
{% elif completeness|lookup:ps.id == 'partial' %}
{% if ps.sessiontype != 'race' %}
<a class="orange dot" href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ rower.id }}/session/{{ ps.id }}">&nbsp;</a>
{% else %}
<a class="orange dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
{% endif %}
{% else %}
{% if ps.sessiontype != 'race' %}
<a class="red dot" href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ rower.id }}/session/{{ ps.id }}">&nbsp;</a>
{% else %}
<a class="red dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
{% endif %}
{% endif %}
</td>
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td>
{% if ps.sessiontype != 'race' %}
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/{{ timeperiod }}/rower/{{ rower.id }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/{{ timeperiod }}/rower/{{ rower.id }}">Unnamed Session</a>
{% endif %}
{% else %}
{% if ps.name != '' %}
<a class="small"
href="/rowers/virtualevent/{{ ps.id }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/virtualevent/{{ ps.id }}">Unnamed Race</a>
{% endif %}
{% endif %}
</td>
<td> {{ ps.get_sessiontype_display }} </td>
<td> {{ ps.get_sessionmode_display }} </td>
<td>
{% if ps.manager == request.user %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/edit/{{ timeperiod }}/rower/{{ rower.id }} ">Edit</a>
{% else %}
&nbsp;
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ actualvalue|lookup:ps.id }}</td>
<td> {{ ps.sessionunit }} </td>
{% if completeness|lookup:ps.id == 'partial' %}
<td style="color:darkgray"><i> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</i></td>
{% else %} {% else %}
<td> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</td> <a class="white dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
{% endif %} {% endif %}
</tr> {% elif completeness|lookup:ps.id == 'completed' %}
{% endfor %} {% if ps.sessiontype != 'race' %}
</tbody> <a class="green dot"
</table> href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}/?when={{ timeperiod }}">&nbsp;</a>
{% else %} {% else %}
You have no planned workouts for this period. Planned workouts are created <a class="green dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
by your coach if you are part of a team. You can create your own {% endif %}
planned workouts by purchasing the "Coach" or "Self-Coach" plans. {% elif completeness|lookup:ps.id == 'partial' %}
{% endif %} {% if ps.sessiontype != 'race' %}
<p> <a class="orange dot"
<a class="grid_2 button gray" href="/rowers/sessions/print/{{ timeperiod }}/rower/{{ rower.id }}">Print View</a> href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}?when={{ timeperiod }}">&nbsp;</a>
<p> {% else %}
{% if unmatchedworkouts %} <a class="orange dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
<h1>Workouts that are not linked to any session</h1> {% endif %}
{% else %}
{% if ps.sessiontype != 'race' %}
<a class="red dot"
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}?when={{ timeperiod }}">&nbsp;</a>
{% else %}
<a class="red dot" href="/rowers/virtualevent/{{ ps.id }}/submit">&nbsp;</a>
{% endif %}
{% endif %}
</td>
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td>
{% if ps.sessiontype != 'race' %}
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/user/{{ rower.user.id }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/user/{{ rower.user.id }}">Unnamed Session</a>
{% endif %}
{% else %}
{% if ps.name != '' %}
<a class="small"
href="/rowers/virtualevent/{{ ps.id }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/virtualevent/{{ ps.id }}">Unnamed Race</a>
{% endif %}
{% endif %}
</td>
<td> {{ ps.get_sessiontype_display }} </td>
<td> {{ ps.get_sessionmode_display }} </td>
<td>
{% if ps.manager == request.user %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/edit/user/{{ rower.user.id }}/?when={{ timeperiod }}">Edit</a>
{% else %}
&nbsp;
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ actualvalue|lookup:ps.id }}</td>
<td> {{ ps.sessionunit }} </td>
{% if completeness|lookup:ps.id == 'partial' %}
<td style="color:darkgray"><i> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</i></td>
{% else %}
<td> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
You have no planned workouts for this period. Planned workouts are created
by your coach if you are part of a team. You can create your own
planned workouts by purchasing the "Coach" or "Self-Coach" plans.
{% endif %}
<p>
<a class="grid_2 button gray"
href="/rowers/sessions/print/user/{{ rower.user.id }}/?when={{ timeperiod }}">
Print View</a>
</p>
{% if unmatchedworkouts %}
<h2>Workouts that are not linked to any session</h2>
<p>
<table width="90%" class="listtable shortpadded"> <table width="90%" class="listtable shortpadded">
<thead> <thead>
<tr> <tr>
<th style="width:80"> Date</th> <th style="width:80"> Date</th>
<th> Time</th> <th align="left"> Time</th>
<th> Name</th> <th align="left"> Name</th>
<th> Type</th> <th align="left"> Type</th>
<th> Distance </th> <th align="left"> Distance </th>
<th> Duration </th> <th align="left"> Duration </th>
<th> Avg HR </th> <th align="left"> Avg HR </th>
<th> Max HR </th> <th align="left"> Max HR </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -211,12 +167,16 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}
</div> </p>
</form> {% endblock %}
{% block sidebar %}
{% include 'menu_plan.html' %}
{% endblock %} {% endblock %}

View File

@@ -14232,10 +14232,17 @@ def plannedsessions_coach_view(request,
) )
@login_required() @login_required()
def plannedsessions_view(request,timeperiod='thisweek',userid=0): def plannedsessions_view(request,
userid=0):
r = getrequestrower(request,userid=userid) r = getrequestrower(request,userid=userid)
when = request.GET.get('when')
if when:
timeperiod = when
else:
timeperiod = 'thisweek'
startdate,enddate = get_dates_timeperiod(timeperiod) startdate,enddate = get_dates_timeperiod(timeperiod)
try: try:
@@ -14270,6 +14277,7 @@ def plannedsessions_view(request,timeperiod='thisweek',userid=0):
'teams':get_my_teams(request.user), 'teams':get_my_teams(request.user),
'plannedsessions':sps, 'plannedsessions':sps,
'plan':trainingplan, 'plan':trainingplan,
'active': 'nav-plan',
'rower':r, 'rower':r,
'timeperiod':timeperiod, 'timeperiod':timeperiod,
'completeness':completeness, 'completeness':completeness,