fix #416
This commit is contained in:
@@ -517,6 +517,10 @@ def course_length(course):
|
|||||||
polygons = GeoPolygon.objects.filter(course=course).order_by("order_in_course")
|
polygons = GeoPolygon.objects.filter(course=course).order_by("order_in_course")
|
||||||
|
|
||||||
totaldist = 0
|
totaldist = 0
|
||||||
|
|
||||||
|
if not polygons:
|
||||||
|
return 0
|
||||||
|
|
||||||
for i in range(len(polygons)-1):
|
for i in range(len(polygons)-1):
|
||||||
latitude1,longitude1 = polygon_coord_center(polygons[i])
|
latitude1,longitude1 = polygon_coord_center(polygons[i])
|
||||||
latitude2,longitude2 = polygon_coord_center(polygons[i+1])
|
latitude2,longitude2 = polygon_coord_center(polygons[i+1])
|
||||||
@@ -2009,6 +2013,7 @@ class PlannedSessionForm(ModelForm):
|
|||||||
super(PlannedSessionForm, self).__init__(*args, **kwargs)
|
super(PlannedSessionForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
|
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
|
||||||
|
|
||||||
|
|
||||||
def get_course_timezone(course):
|
def get_course_timezone(course):
|
||||||
polygons = GeoPolygon.objects.filter(course = course)
|
polygons = GeoPolygon.objects.filter(course = course)
|
||||||
points = GeoPoint.objects.filter(polygon = polygons[0])
|
points = GeoPoint.objects.filter(polygon = polygons[0])
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
<li>
|
<li class="grid_2">
|
||||||
<p>
|
<p>
|
||||||
<form enctype="multipart/form-data" method="get">
|
<form enctype="multipart/form-data" method="get">
|
||||||
<table>
|
<table>
|
||||||
@@ -18,6 +18,14 @@
|
|||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<p>
|
<p>
|
||||||
On this page, you can create and edit sessions for an entire time
|
On this page, you can create and edit sessions for an entire time
|
||||||
|
|||||||
@@ -7,17 +7,25 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
<p>{{ timeperiod }}</p>
|
|
||||||
<p>
|
|
||||||
<form enctype="multipart/form-data" method="get">
|
|
||||||
<table>
|
|
||||||
{{ dateform.as_table }}
|
|
||||||
</table>
|
|
||||||
<input type="Submit" value="Set Date Range">
|
|
||||||
</form>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
|
<li class="grid_2">
|
||||||
|
<p>
|
||||||
|
<form enctype="multipart/form-data" method="get">
|
||||||
|
<table>
|
||||||
|
{{ dateform.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>New Session</h1>
|
<h1>New Session</h1>
|
||||||
<form enctype="multipart/form-data" action=""
|
<form enctype="multipart/form-data" action=""
|
||||||
|
|||||||
@@ -7,17 +7,27 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Edit Session</h1>
|
<h1>Edit Session</h1>
|
||||||
|
|
||||||
<p>
|
|
||||||
<form enctype="multipart/form-data" method="get">
|
|
||||||
<table>
|
|
||||||
{{ dateform.as_table }}
|
|
||||||
</table>
|
|
||||||
<input type="Submit" value="Set Date Range">
|
|
||||||
</form>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
|
<li class="grid_2">
|
||||||
|
<p>
|
||||||
|
<form enctype="multipart/form-data" method="get">
|
||||||
|
<table>
|
||||||
|
{{ dateform.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h2>{{ thesession.name }}</h2>
|
<h2>{{ thesession.name }}</h2>
|
||||||
{% if user.is_authenticated and user|is_manager %}
|
{% if user.is_authenticated and user|is_manager %}
|
||||||
|
|||||||
@@ -19,6 +19,14 @@
|
|||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
{% if plannedsessions %}
|
{% if plannedsessions %}
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -66,35 +66,47 @@
|
|||||||
|
|
||||||
<h1>Clone Multiple Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Clone Multiple Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
<p>
|
<ul class="main-content">
|
||||||
<form enctype="multipart/form-data" method="get">
|
<li class="grid_2">
|
||||||
<table>
|
<p>
|
||||||
{{ dateform.as_table }}
|
<form enctype="multipart/form-data" method="get">
|
||||||
</table>
|
<table>
|
||||||
<input type="Submit" value="Set Date Range">
|
{{ dateform.as_table }}
|
||||||
</form>
|
</table>
|
||||||
</p>
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
<form enctype="multipart/form-data" method="post">
|
</li>
|
||||||
<ul class="main-content">
|
<li class="grid_2">
|
||||||
<li class="grid_2">
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="grid_4">
|
||||||
|
<form enctype="multipart/form-data" method="post">
|
||||||
|
|
||||||
|
|
||||||
{% if plannedsessions %}
|
{% if plannedsessions %}
|
||||||
|
|
||||||
<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>
|
|
||||||
|
|
||||||
<table width="100%" class="listtable">
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{{ form.as_table }}
|
{{ form.as_table }}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p> No sessions found </p>
|
<p> No sessions found </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
<p>Select one or more planned sessions,
|
||||||
<li class="grid_2">
|
|
||||||
<p>Select one or more planned sessions on the left,
|
|
||||||
select the date when the new cycle starts below
|
select the date when the new cycle starts below
|
||||||
and press submit</p>
|
and press submit</p>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
@@ -106,9 +118,9 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>You can use the date and search forms above to search through all
|
<p>You can use the date and search forms above to search through all
|
||||||
sessions.</p>
|
sessions.</p>
|
||||||
</li>
|
</form>
|
||||||
</ul>
|
</li>
|
||||||
</form>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -11,125 +11,139 @@
|
|||||||
<h1>Coach Overview</h1>
|
<h1>Coach Overview</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p>
|
<ul class="main-content">
|
||||||
<form enctype="multipart/form-data" method="get">
|
<li class="grid_2">
|
||||||
<table>
|
<p>
|
||||||
{{ dateform.as_table }}
|
<form enctype="multipart/form-data" method="get">
|
||||||
|
<table>
|
||||||
|
{{ dateform.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_4">
|
||||||
|
|
||||||
|
|
||||||
|
<table width="90%" class="listtable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align="left">On or after</th>
|
||||||
|
<th align="left">On or before</th>
|
||||||
|
<th align="left">Preferred date</th>
|
||||||
|
<th align="left">Name</th>
|
||||||
|
{% for r in rowers %}
|
||||||
|
<th class="rotate"><div><span>
|
||||||
|
{{ r.user.first_name }} {{ r.user.last_name }}
|
||||||
|
</span></div></th>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for thedict in statusdict %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ thedict|lookup:'startdate'|date:"Y-m-d" }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ thedict|lookup:'enddate'|date:"Y-m-d" }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ thedict|lookup:'preferreddate'|date:"Y-m-d" }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="/rowers/sessions/{{ thedict|lookup:"id" }}">
|
||||||
|
{% if thedict|lookup:'name' %}
|
||||||
|
{{ thedict|lookup:'name' }}
|
||||||
|
{% else %}
|
||||||
|
Unnamed Session
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
{% for r in rowers %}
|
||||||
|
<td>
|
||||||
|
{% if thedict|lookup:'results'|lookup:r.id != 'not assigned' %}
|
||||||
|
<a class="{{ thedict|lookup:'color'|lookup:r.id }} dot"
|
||||||
|
title="{{ thedict|lookup:'results'|lookup:r.id }}"
|
||||||
|
href="{% url 'plannedsession_view' id=thedict|lookup:"id" userid=r.user.id %}"> </a>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<input type="Submit" value="Set Date Range">
|
</li>
|
||||||
</form>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
{% if unmatchedworkouts %}
|
||||||
<table width="90%" class="listtable">
|
<li class="grid_4">
|
||||||
<thead>
|
<h1>Workouts that are not linked to any session</h1>
|
||||||
<tr>
|
<table width="90%" class="listtable shortpadded">
|
||||||
<th align="left">On or after</th>
|
<thead>
|
||||||
<th align="left">On or before</th>
|
<tr>
|
||||||
<th align="left">Preferred date</th>
|
<th> Rower</th>
|
||||||
<th align="left">Name</th>
|
<th style="width:80"> Date</th>
|
||||||
{% for r in rowers %}
|
<th> Time</th>
|
||||||
<th class="rotate"><div><span>
|
<th> Name</th>
|
||||||
{{ r.user.first_name }} {{ r.user.last_name }}
|
<th> Type</th>
|
||||||
</span></div></th>
|
<th> Distance </th>
|
||||||
{% endfor %}
|
<th> Duration </th>
|
||||||
</tr>
|
<th> Avg HR </th>
|
||||||
</thead>
|
<th> Max HR </th>
|
||||||
<tbody>
|
</tr>
|
||||||
{% for thedict in statusdict %}
|
</thead>
|
||||||
<tr>
|
<tbody>
|
||||||
<td>
|
{% for workout in unmatchedworkouts %}
|
||||||
{{ thedict|lookup:'startdate'|date:"Y-m-d" }}
|
<tr>
|
||||||
</td>
|
<td> {{ workout.user.user.first_name }} {{ workout.user.user.last_name }} </td>
|
||||||
<td>
|
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
||||||
{{ thedict|lookup:'enddate'|date:"Y-m-d" }}
|
<td> {{ workout.starttime|date:"H:i" }} </td>
|
||||||
</td>
|
{% if workout.user.user == user or user == team.manager %}
|
||||||
<td>
|
{% if workout.name != '' %}
|
||||||
{{ thedict|lookup:'preferreddate'|date:"Y-m-d" }}
|
<td>
|
||||||
</td>
|
<a href={% url rower.defaultlandingpage id=workout.id %}>
|
||||||
<td>
|
{{ workout.name }}
|
||||||
<a href="/rowers/sessions/{{ thedict|lookup:"id" }}">
|
</a>
|
||||||
{% if thedict|lookup:'name' %}
|
</td>
|
||||||
{{ thedict|lookup:'name' }}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
Unnamed Session
|
<td>
|
||||||
|
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name
|
||||||
|
</a></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
{% else %}
|
||||||
</td>
|
{% if workout.name != '' %}
|
||||||
{% for r in rowers %}
|
<td><a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a></td>
|
||||||
<td>
|
{% else %}
|
||||||
{% if thedict|lookup:'results'|lookup:r.id != 'not assigned' %}
|
<td><a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
||||||
<a class="{{ thedict|lookup:'color'|lookup:r.id }} dot"
|
{% endif %}
|
||||||
title="{{ thedict|lookup:'results'|lookup:r.id }}"
|
{% endif %}
|
||||||
href="{% url 'plannedsession_view' id=thedict|lookup:"id" userid=r.user.id %}"> </a>
|
<td> {{ workout.workouttype }} </td>
|
||||||
{% else %}
|
<td> {{ workout.distance }}m</td>
|
||||||
|
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
|
||||||
{% endif %}
|
<td> {{ workout.averagehr }} </td>
|
||||||
</td>
|
<td> {{ workout.maxhr }} </td>
|
||||||
{% endfor %}
|
</tr>
|
||||||
</tr>
|
{% endfor %}
|
||||||
{% endfor %}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
</li>
|
||||||
|
|
||||||
{% if unmatchedworkouts %}
|
|
||||||
<h1>Workouts that are not linked to any session</h1>
|
|
||||||
<table width="90%" class="listtable shortpadded">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th> Rower</th>
|
|
||||||
<th style="width:80"> Date</th>
|
|
||||||
<th> Time</th>
|
|
||||||
<th> Name</th>
|
|
||||||
<th> Type</th>
|
|
||||||
<th> Distance </th>
|
|
||||||
<th> Duration </th>
|
|
||||||
<th> Avg HR </th>
|
|
||||||
<th> Max HR </th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for workout in unmatchedworkouts %}
|
|
||||||
<tr>
|
|
||||||
<td> {{ workout.user.user.first_name }} {{ workout.user.user.last_name }} </td>
|
|
||||||
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
|
||||||
<td> {{ workout.starttime|date:"H:i" }} </td>
|
|
||||||
{% if workout.user.user == user or user == team.manager %}
|
|
||||||
{% if workout.name != '' %}
|
|
||||||
<td>
|
|
||||||
<a href={% url rower.defaultlandingpage id=workout.id %}>
|
|
||||||
{{ workout.name }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
{% else %}
|
|
||||||
<td>
|
|
||||||
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name
|
|
||||||
</a></td>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% if workout.name != '' %}
|
|
||||||
<td><a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a></td>
|
|
||||||
{% else %}
|
|
||||||
<td><a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
<td> {{ workout.workouttype }} </td>
|
|
||||||
<td> {{ workout.distance }}m</td>
|
|
||||||
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
|
|
||||||
<td> {{ workout.averagehr }} </td>
|
|
||||||
<td> {{ workout.maxhr }} </td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
|
|||||||
@@ -19,70 +19,81 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Manage Plan Execution for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Manage Plan Execution for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
<p>
|
<ul class="main-content">
|
||||||
<form enctype="multipart/form-data" method="get">
|
<li class="grid_2">
|
||||||
<table>
|
<p>
|
||||||
{{ dateform.as_table }}
|
<form enctype="multipart/form-data" method="get">
|
||||||
</table>
|
<table>
|
||||||
<input type="Submit" value="Set Date Range">
|
{{ dateform.as_table }}
|
||||||
</form>
|
</table>
|
||||||
</p>
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
<p>Select one session on the left, and one or more workouts on the right
|
</li>
|
||||||
to match the workouts to the session. For tests and training sessions,
|
<li class="grid_2">
|
||||||
the selected workouts must be done on the same date. For all sessions,
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
the workout dates must be between the start and end date for the
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
session.
|
</p>
|
||||||
</p>
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
<p>
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
If you select a workout that has already been matched to another session,
|
</p>
|
||||||
it will change to match this session.
|
</li>
|
||||||
</p>
|
</ul>
|
||||||
<p>
|
|
||||||
Workouts marked with a red check mark (<span style="color:red"><b>✔</b></span>)
|
|
||||||
are currently linked to one of your sessions. A workout can only be assigned to
|
|
||||||
one session at a time.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form id="session_form" action="/rowers/sessions/manage/user/{{ rower.user.id }}/?when={{ timeperiod }}"
|
<form id="session_form" action="/rowers/sessions/manage/user/{{ rower.user.id }}/?when={{ timeperiod }}"
|
||||||
method="post">
|
method="post">
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
<li class="grid_2">
|
<li class="grid_4">
|
||||||
<h2>Planned Sessions</h2>
|
<p>Select one session on the left, and one or more workouts on the right
|
||||||
<table width="100%">
|
to match the workouts to the session. For tests and training sessions,
|
||||||
<tr>
|
the selected workouts must be done on the same date. For all sessions,
|
||||||
{% for field in ps_form.hidden_fields %}
|
the workout dates must be between the start and end date for the
|
||||||
{{ field }}
|
session.
|
||||||
{% endfor %}
|
</p>
|
||||||
{% for field in ps_form.visible_fields %}
|
<p>
|
||||||
<td> {{ field }}</td>
|
If you select a workout that has already been matched to another session,
|
||||||
{% endfor %}
|
it will change to match this session.
|
||||||
</tr>
|
</p>
|
||||||
</table>
|
<p>
|
||||||
</li>
|
Workouts marked with a red check mark (<span style="color:red"><b>✔</b></span>)
|
||||||
<li class="grid_2">
|
are currently linked to one of your sessions. A workout can only be assigned to
|
||||||
<h2>Workouts</h2>
|
one session at a time.
|
||||||
<table width="100%">
|
</p>
|
||||||
<tr>
|
</li>
|
||||||
{% for field in w_form.hidden_fields %}
|
<li class="grid_2".
|
||||||
{{ field }}
|
<h2>Planned Sessions</h2>
|
||||||
{% endfor %}
|
<table width="100%">
|
||||||
{% for field in w_form.visible_fields %}
|
<tr>
|
||||||
<td>
|
{% for field in ps_form.hidden_fields %}
|
||||||
{{ field }}
|
{{ field }}
|
||||||
</td>
|
{% endfor %}
|
||||||
{% endfor %}
|
{% for field in ps_form.visible_fields %}
|
||||||
</tr>
|
<td> {{ field }}</td>
|
||||||
</table>
|
{% endfor %}
|
||||||
</li>
|
</tr>
|
||||||
<li class="grid_2">
|
</table>
|
||||||
{% csrf_token %}
|
|
||||||
<input class="button green" type="submit" value="Submit">
|
|
||||||
</li>
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<h2>Workouts</h2>
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
{% for field in w_form.hidden_fields %}
|
||||||
|
{{ field }}
|
||||||
|
{% endfor %}
|
||||||
|
{% for field in w_form.visible_fields %}
|
||||||
|
<td>
|
||||||
|
{{ field }}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input class="button green" type="submit" value="Submit">
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,26 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Create Team Session</h1>
|
<h1>Create Team Session</h1>
|
||||||
|
|
||||||
<p>
|
<ul class="main-content">
|
||||||
<form enctype="multipart/form-data" method="get">
|
<li class="grid_2">
|
||||||
<table>
|
<p>
|
||||||
{{ dateform.as_table }}
|
<form enctype="multipart/form-data" method="get">
|
||||||
</table>
|
<table>
|
||||||
<input type="Submit" value="Set Date Range">
|
{{ dateform.as_table }}
|
||||||
</form>
|
</table>
|
||||||
</p>
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
|
|||||||
@@ -7,16 +7,26 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Edit Team Session</h1>
|
<h1>Edit Team Session</h1>
|
||||||
|
|
||||||
<p>
|
<ul class="main-content">
|
||||||
<form enctype="multipart/form-data" method="get">
|
<li class="grid_2">
|
||||||
<table>
|
<p>
|
||||||
{{ dateform.as_table }}
|
<form enctype="multipart/form-data" method="get">
|
||||||
</table>
|
<table>
|
||||||
<input type="Submit" value="Set Date Range">
|
{{ dateform.as_table }}
|
||||||
</form>
|
</table>
|
||||||
</p>
|
<input type="Submit" value="Set Date Range">
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
|
||||||
|
{{ timeperiod|timedeltadays }} days</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
<p style="color: red;">
|
<p style="color: red;">
|
||||||
@@ -36,12 +46,16 @@
|
|||||||
<table>
|
<table>
|
||||||
{{ teamform.as_table }}
|
{{ teamform.as_table }}
|
||||||
</table></p>
|
</table></p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
<h1>Select Rowers</h1>
|
<h1>Select Rowers</h1>
|
||||||
<p>
|
<p>
|
||||||
<table>
|
<table>
|
||||||
{{ rowersform.as_table }}
|
{{ rowersform.as_table }}
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
<h1>Session {{ plannedsession.name }}</h1>
|
<h1>Session {{ plannedsession.name }}</h1>
|
||||||
<table>
|
<table>
|
||||||
{{ form.as_table }}
|
{{ form.as_table }}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ from rowers.utils import NoTokenError
|
|||||||
|
|
||||||
import rowers.payments as payments
|
import rowers.payments as payments
|
||||||
|
|
||||||
|
import arrow
|
||||||
|
|
||||||
def strfdelta(tdelta):
|
def strfdelta(tdelta):
|
||||||
minutes,seconds = divmod(tdelta.seconds,60)
|
minutes,seconds = divmod(tdelta.seconds,60)
|
||||||
tenths = int(tdelta.microseconds/1e5)
|
tenths = int(tdelta.microseconds/1e5)
|
||||||
@@ -101,6 +103,57 @@ def durationprint(d,dstring):
|
|||||||
else:
|
else:
|
||||||
return d.strftime(dstring)[:-5]
|
return d.strftime(dstring)[:-5]
|
||||||
|
|
||||||
|
def getstartenddate(timeperiod):
|
||||||
|
s,e = timeperiod.split('/')
|
||||||
|
startdate = arrow.get(s).date()
|
||||||
|
enddate = arrow.get(e).date()
|
||||||
|
|
||||||
|
return startdate,enddate
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def nextperiodend(timeperiod):
|
||||||
|
startdate,enddate = getstartenddate(timeperiod)
|
||||||
|
timedelta = enddate-startdate
|
||||||
|
newstartdate = enddate+datetime.timedelta(days=1)
|
||||||
|
newenddate = newstartdate+timedelta
|
||||||
|
|
||||||
|
return newenddate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def nextperiodstart(timeperiod):
|
||||||
|
startdate,enddate = getstartenddate(timeperiod)
|
||||||
|
timedelta = enddate-startdate
|
||||||
|
newstartdate = enddate+datetime.timedelta(days=1)
|
||||||
|
newenddate = newstartdate+timedelta
|
||||||
|
|
||||||
|
return newstartdate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def previousperiodend(timeperiod):
|
||||||
|
startdate,enddate = getstartenddate(timeperiod)
|
||||||
|
timedelta = enddate-startdate
|
||||||
|
newenddate = startdate-datetime.timedelta(days=1)
|
||||||
|
newstartdate = startdate-timedelta-datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
return newenddate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def timedeltadays(timeperiod):
|
||||||
|
startdate,enddate = getstartenddate(timeperiod)
|
||||||
|
timedelta = enddate-startdate
|
||||||
|
|
||||||
|
return timedelta.days+1
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def previousperiodstart(timeperiod):
|
||||||
|
startdate,enddate = getstartenddate(timeperiod)
|
||||||
|
timedelta = enddate-startdate
|
||||||
|
newenddate = startdate-datetime.timedelta(days=1)
|
||||||
|
newstartdate = startdate-timedelta-datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
return newstartdate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def paceprint(d):
|
def paceprint(d):
|
||||||
if (d == None):
|
if (d == None):
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
2
rowers/tests/testdata/testdata.tcx
vendored
2
rowers/tests/testdata/testdata.tcx
vendored
@@ -2502,7 +2502,7 @@
|
|||||||
</Trackpoint>
|
</Trackpoint>
|
||||||
</Track>
|
</Track>
|
||||||
</Lap>
|
</Lap>
|
||||||
<Notes><Element 'Notes' at 0x137bd4e0></Notes>
|
<Notes><Element 'Notes' at 0x148f4cf8></Notes>
|
||||||
</Activity>
|
</Activity>
|
||||||
</Activities>
|
</Activities>
|
||||||
<Creator>
|
<Creator>
|
||||||
|
|||||||
@@ -16512,7 +16512,7 @@ def plannedsession_view(request,id=0,userid=0):
|
|||||||
mm = Rower.objects.get(user=m)
|
mm = Rower.objects.get(user=m)
|
||||||
|
|
||||||
if ps.manager != request.user:
|
if ps.manager != request.user:
|
||||||
if r.rowerplan == 'coach':
|
if r.rowerplan == 'coach' and r not in ps.rower.all():
|
||||||
teams = Team.objects.filter(manager=request.user)
|
teams = Team.objects.filter(manager=request.user)
|
||||||
members = Rower.objects.filter(team__in=teams).distinct()
|
members = Rower.objects.filter(team__in=teams).distinct()
|
||||||
teamusers = [m.user for m in members]
|
teamusers = [m.user for m in members]
|
||||||
|
|||||||
Reference in New Issue
Block a user