Private
Public Access
1
0
Files
rowsandall/rowers/templates/plannedsessionview.html

208 lines
6.3 KiB
HTML

{% extends "newbase.html" %}
{% load static %}
{% load rowerfilters %}
{% load leaflet_tags %}
{% block meta %}
{% leaflet_js %}
{% leaflet_css %}
{% endblock %}
{% block title %}Planned Session{% endblock %}
{% block main %}
{% if user.is_authenticated and psdict.id.1|is_session_manager:user %}
<p>
<a href="/rowers/sessions/{{ psdict.id.1 }}/edit/user/{{ rower.user.id }}">
<i class="fas fa-pencil-alt fa-fw"></i> Edit Session</a>
/
<a href="/rowers/sessions/{{ psdict.id.1 }}/maketemplate/?next={{ request.path|urlencode }}"><i class="fas fa-books fa-fw"></i> Save to Library</a>
{% if psdict.garmin_schedule_id.1 %}
<i class="fas fa-watch-fitness fa-fw"></i>Exported to Garmin
{% else %}
<a href="/rowers/sessions/{{ psdict.id.1 }}/togarmin/?next={{ request.path|urlencode }}"><i class="fas fa-watch-fitness fa-fw"></i> Export to Garmin</a>
{% endif %}
{% if plannedsession.intervals_icu_id %}
<a href="https://intervals.icu/?w={{ plannedsession.preferreddate }}"><i class="fa-solid fa-wave-pulse"></i> Exported to intervals.icu</a>
{% else %}
<a href="/rowers/sessions/{{ psdict.id.1 }}/tointervals/?next={{ request.path|urlencode }}"><i class="fa-solid fa-wave-pulse fa-fw"></i> Export to intervals.icu</a>
{% endif %}
</p>
{% endif %}
<h1>Session {{ psdict.name.1 }}</h1>
<ul class="main-content">
<li class="grid_2">
<table class="listtable shortpadded" width="95%">
{% for attr in attrs %}
{% for key,value in psdict.items %}
{% if key == attr %}
<tr>
{% if key == 'comment' %}
<td><b>{{ value.0 }}</b></td><td class="wrapwords">{{ value.1|linebreaks|urlshorten:"50" }}</td>
{% else %}
{% if value.1 %}
<td><b>{{ value.0 }}</b></td><td class="wrapwords">{{ value.1 }}</td>
{% endif %}
{% endif %}
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</table>
{% if steps %}
<h2>Steps</h2>
<p>{{ steps|safe }}</p>
{% endif %}
</li>
<li class="grid_2">
{% if plannedsession.sessiontype == 'test' or plannedsession.sessiontype == 'coursetest' or plannedsession.sessiontype == 'fastest_distance' or plannedsession.sessiontype == 'fastest_time' %}
<h2>Ranking</h2>
<table id="rankingtable" class="listtable shortpadded tablesorter" width="80%">
<thead>
<tr>
<th>Nr</th>
<th>Name</th>
<th>Distance</th>
<th>Time</th>
<th>Date</th>
<th>Type</th>
</tr>
</thead>
<tbody>
{% for result in ranking %}
{% if result|lookup:'coursecompleted' %}
<tr>
<td>{{ forloop.counter }}</td>
<td>
<a href="{% url 'workout_view' id=result|lookup:'workoutid'|encode sessionresult=result|lookup:'sessionresult' %}">
{{ result|lookup:'name' }}
</a>
</td>
<td>{{ result|lookup:'distance' }}</td>
<td>{{ result|lookup:'time'|deltatimeprint }}</td>
<td>{{ result|lookup:'date'|date:"Y-m-d" }}</td>
<td>{{ result|lookup:'type' }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endif %}
<h1>Workouts attached</h1>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>Date</th>
<th>Name</th>
<th>Distance</th>
<th>Duration</th>
</tr>
</thead>
<tbody>
{% for workout in workouts %}
<tr>
<td> {{ workout.date|date:"Y-m-d" }} </td>
<td>
<a href="{% url 'workout_view' id=workout.id|encode %}">
{{ workout.name }}
</a>
</td>
<td> {{ workout.distance }}m</td>
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
<td>
<a href="/rowers/sessions/{{ psdict.id.1 }}/detach/{{ workout.id|encode }}/">Detach</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>
<a href="/rowers/sessions/manage/session/{{ psdict.id.1 }}/">
Add, remove or change workouts for this session</a>
</p>
</li>
<li class="grid_2">
<h2>{{ rower.user.first_name }} {{ rower.user.last_name }}</h2>
<p>Status: {{ status }}</p>
<p>Percentage complete: {{ ratio }} </p>
</li>
<li class="grid_2">
<h2>Stats</h2>
<table class="listtable shortpadded" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Minutes</th>
<th>Meters</th>
<th>rScore</th>
<th>TRIMP</th>
<th>Complete Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for id, value in results.items %}
<tr>
<td>{{ value|lookup:'first_name' }} {{ value|lookup:'last_name' }}</td>
<td>{{ value|lookup:'duration' }}</td>
<td>{{ value|lookup:'distance' }}</td>
<td>{{ value|lookup:'rscore' }}</td>
<td>{{ value|lookup:'trimp' }}</td>
<td>{{ value|lookup:'completedate' }}</td>
<td>{{ value|lookup:'status' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>
<a href="/rowers/sessions/{{ psdict.id.1 }}/compare"
title="Compare the workouts of all athletes who did this session">Compare Workouts</a>
</p>
</li>
<li class="grid_2">
<div id="comments">
<h2>Comments ({{ comments|length }})</h2>
{% for c in comments %}
<p>
<em>{{ c.user.first_name }} {{ c.user.last_name }}</em> - {{ c.created }}</br>
<q>{{ c.comment }}</q>
</p>
{% endfor %}
<p>
<a href="/rowers/sessions/{{ psdict.id.1 }}/comments/">Add a comment</a>
</p>
</div>
</li>
{% if coursescript %}
<li class="grid_2">
<h2><a href="/rowers/courses/{{ plannedsession.course.id }}">{{ plannedsession.course.name }}</h2>
{{ coursediv|safe }}
{{ coursescript|safe }}
</li>
{% endif %}
</ul>
{% endblock %}
{% block sidebar %}
{% include 'menu_plan.html' %}
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.tablesorter.widgets.js"></script>
<script>
$( document ).ready(function() {
$("#rankingtable").tablesorter();
});
</script>
{% endblock %}