Merge branch 'feature/sessionpermissions' into develop
This commit is contained in:
@@ -517,6 +517,10 @@ def course_length(course):
|
||||
polygons = GeoPolygon.objects.filter(course=course).order_by("order_in_course")
|
||||
|
||||
totaldist = 0
|
||||
|
||||
if not polygons:
|
||||
return 0
|
||||
|
||||
for i in range(len(polygons)-1):
|
||||
latitude1,longitude1 = polygon_coord_center(polygons[i])
|
||||
latitude2,longitude2 = polygon_coord_center(polygons[i+1])
|
||||
@@ -2009,6 +2013,7 @@ class PlannedSessionForm(ModelForm):
|
||||
super(PlannedSessionForm, self).__init__(*args, **kwargs)
|
||||
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
|
||||
|
||||
|
||||
def get_course_timezone(course):
|
||||
polygons = GeoPolygon.objects.filter(course = course)
|
||||
points = GeoPoint.objects.filter(polygon = polygons[0])
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
<ul class="main-content">
|
||||
<li>
|
||||
<li class="grid_2">
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="get">
|
||||
<table>
|
||||
@@ -18,6 +18,14 @@
|
||||
</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">
|
||||
<p>
|
||||
On this page, you can create and edit sessions for an entire time
|
||||
|
||||
@@ -7,17 +7,25 @@
|
||||
{% block main %}
|
||||
<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">
|
||||
<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">
|
||||
<h1>New Session</h1>
|
||||
<form enctype="multipart/form-data" action=""
|
||||
|
||||
@@ -7,17 +7,27 @@
|
||||
{% block main %}
|
||||
<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">
|
||||
<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">
|
||||
<h2>{{ thesession.name }}</h2>
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
|
||||
@@ -19,6 +19,14 @@
|
||||
</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">
|
||||
{% if plannedsessions %}
|
||||
<p>
|
||||
|
||||
@@ -66,35 +66,47 @@
|
||||
|
||||
<h1>Clone Multiple Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="get">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
<input type="Submit" value="Set Date Range">
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
<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_4">
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
|
||||
|
||||
{% 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 }}
|
||||
</table>
|
||||
|
||||
{% else %}
|
||||
<p> No sessions found </p>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<p>Select one or more planned sessions on the left,
|
||||
<p>Select one or more planned sessions,
|
||||
select the date when the new cycle starts below
|
||||
and press submit</p>
|
||||
{% csrf_token %}
|
||||
@@ -106,9 +118,9 @@
|
||||
</p>
|
||||
<p>You can use the date and search forms above to search through all
|
||||
sessions.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -11,125 +11,139 @@
|
||||
<h1>Coach Overview</h1>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="get">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
<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_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>
|
||||
<input type="Submit" value="Set Date Range">
|
||||
</form>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
|
||||
<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' }}
|
||||
{% if unmatchedworkouts %}
|
||||
<li class="grid_4">
|
||||
<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 %}
|
||||
Unnamed Session
|
||||
<td>
|
||||
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name
|
||||
</a></td>
|
||||
{% 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>
|
||||
|
||||
{% 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>
|
||||
|
||||
{% 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>
|
||||
</li>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
|
||||
@@ -19,70 +19,81 @@
|
||||
{% block main %}
|
||||
<h1>Manage Plan Execution for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="get">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
<input type="Submit" value="Set Date Range">
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
<p>Select one session on the left, and one or more workouts on the right
|
||||
to match the workouts to the session. For tests and training sessions,
|
||||
the selected workouts must be done on the same date. For all sessions,
|
||||
the workout dates must be between the start and end date for the
|
||||
session.
|
||||
</p>
|
||||
<p>
|
||||
If you select a workout that has already been matched to another session,
|
||||
it will change to match this session.
|
||||
</p>
|
||||
<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>
|
||||
<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>
|
||||
</ul>
|
||||
|
||||
<form id="session_form" action="/rowers/sessions/manage/user/{{ rower.user.id }}/?when={{ timeperiod }}"
|
||||
method="post">
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
<h2>Planned Sessions</h2>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
{% for field in ps_form.hidden_fields %}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
{% for field in ps_form.visible_fields %}
|
||||
<td> {{ field }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
</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 class="grid_4">
|
||||
<p>Select one session on the left, and one or more workouts on the right
|
||||
to match the workouts to the session. For tests and training sessions,
|
||||
the selected workouts must be done on the same date. For all sessions,
|
||||
the workout dates must be between the start and end date for the
|
||||
session.
|
||||
</p>
|
||||
<p>
|
||||
If you select a workout that has already been matched to another session,
|
||||
it will change to match this session.
|
||||
</p>
|
||||
<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>
|
||||
</li>
|
||||
<li class="grid_2".
|
||||
<h2>Planned Sessions</h2>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
{% for field in ps_form.hidden_fields %}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
{% for field in ps_form.visible_fields %}
|
||||
<td> {{ field }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
</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>
|
||||
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -7,15 +7,26 @@
|
||||
{% block main %}
|
||||
<h1>Create Team 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">
|
||||
<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>
|
||||
</ul>
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
{% if form.errors %}
|
||||
|
||||
@@ -7,16 +7,26 @@
|
||||
{% block main %}
|
||||
<h1>Edit Team 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">
|
||||
<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>
|
||||
</ul>
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
@@ -36,12 +46,16 @@
|
||||
<table>
|
||||
{{ teamform.as_table }}
|
||||
</table></p>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Select Rowers</h1>
|
||||
<p>
|
||||
<table>
|
||||
{{ rowersform.as_table }}
|
||||
</table>
|
||||
</p>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Session {{ plannedsession.name }}</h1>
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
|
||||
@@ -26,6 +26,8 @@ from rowers.utils import NoTokenError
|
||||
|
||||
import rowers.payments as payments
|
||||
|
||||
import arrow
|
||||
|
||||
def strfdelta(tdelta):
|
||||
minutes,seconds = divmod(tdelta.seconds,60)
|
||||
tenths = int(tdelta.microseconds/1e5)
|
||||
@@ -101,6 +103,57 @@ def durationprint(d,dstring):
|
||||
else:
|
||||
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
|
||||
def paceprint(d):
|
||||
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>
|
||||
</Track>
|
||||
</Lap>
|
||||
<Notes><Element 'Notes' at 0x137bd4e0></Notes>
|
||||
<Notes><Element 'Notes' at 0x14e07da0></Notes>
|
||||
</Activity>
|
||||
</Activities>
|
||||
<Creator>
|
||||
|
||||
@@ -16512,7 +16512,7 @@ def plannedsession_view(request,id=0,userid=0):
|
||||
mm = Rower.objects.get(user=m)
|
||||
|
||||
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)
|
||||
members = Rower.objects.filter(team__in=teams).distinct()
|
||||
teamusers = [m.user for m in members]
|
||||
|
||||
Reference in New Issue
Block a user