date selector works on plannedsessions
This commit is contained in:
@@ -1040,6 +1040,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
barchart=True, otwpower=True, empower=True, inboard=inboard)
|
||||
|
||||
rscore,normp = workout_rscore(w)
|
||||
trimp,hrtss = workout_trimp(w)
|
||||
|
||||
isbreakthrough = False
|
||||
ishard = False
|
||||
|
||||
@@ -853,6 +853,9 @@ def update_agegroup_db(age,sex,weightcategory,wcdurations,wcpower,
|
||||
|
||||
delete_agegroup_db(age,sex,weightcategory,debug=debug)
|
||||
|
||||
wcdurations = [None if type(y) is float and np.isnan(y) else y for y in wcdurations]
|
||||
wcpower = [None if type(y) is float and np.isnan(y) else y for y in wcpower]
|
||||
|
||||
df = pd.DataFrame(
|
||||
{
|
||||
'duration':wcdurations,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
from django.utils import timezone
|
||||
from rowers.models import Workout, PowerTimeFitnessMetric, Rower
|
||||
import datetime
|
||||
|
||||
@@ -30,6 +30,7 @@ import numpy as np
|
||||
import dataprep
|
||||
import courses
|
||||
import iso8601
|
||||
from iso8601 import ParseError
|
||||
from rowers.tasks import handle_check_race_course
|
||||
|
||||
def get_todays_micro(plan,thedate=date.today()):
|
||||
@@ -411,7 +412,7 @@ def get_dates_timeperiod(request,startdatestring='',enddatestring=''):
|
||||
startdatestring = request.GET.get('startdate')
|
||||
enddatestring = request.GET.get('enddate')
|
||||
|
||||
if startdate and enddate:
|
||||
if startdatestring and enddatestring:
|
||||
startdate = dt.datetime.strptime(startdatestring,'%Y-%m-%d').date()
|
||||
enddate = dt.datetime.strptime(enddatestring,'%Y-%m-%d').date()
|
||||
return startdate,enddate
|
||||
|
||||
@@ -82,62 +82,6 @@
|
||||
|
||||
<p> </p>
|
||||
|
||||
<ul class="cd-accordion-menu animated">
|
||||
<li class="has-children" id="cycles">
|
||||
<input type="checkbox" name="cycle-selector" id="cycle-selector">
|
||||
<label for="cycle-selector"><i class="far fa-calendar-alt fa-fw"></i> Select Time Period</label>
|
||||
<ul>
|
||||
<li class="has-children" id="cycles-this">
|
||||
<input type="checkbox" name="cycle-this" id="cycle-this">
|
||||
<label for="cycle-this">This</label>
|
||||
<ul>
|
||||
<li>
|
||||
<a href = {{ request.path|timeurl:"thisweek" }}>
|
||||
Week
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href = {{ request.path|timeurl:"thismonth" }}>
|
||||
Month
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-children" id="cycles-next">
|
||||
<input type="checkbox" name="cycle-next" id="cycle-next">
|
||||
<label for="cycle-next">Next</label>
|
||||
<ul>
|
||||
<li>
|
||||
<a href = {{ request.path|timeurl:"nextweek" }}>
|
||||
Week
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href = {{ request.path|timeurl:"nextmonth" }}>
|
||||
Month
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-children" id="cycles-Last">
|
||||
<input type="checkbox" name="cycle-Last" id="cycle-Last">
|
||||
<label for="cycle-Last">Last</label>
|
||||
<ul>
|
||||
<li>
|
||||
<a href = {{ request.path|timeurl:"lastweek" }}>
|
||||
Week
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href = {{ request.path|timeurl:"lastmonth" }}>
|
||||
Month
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
|
||||
@@ -8,12 +8,24 @@
|
||||
|
||||
<h1>Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
{% if plannedsessions %}
|
||||
<p>
|
||||
<ul class="main-content">
|
||||
<li>
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="get">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
<input type="Submit">
|
||||
</form>
|
||||
</p>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
{% 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">
|
||||
</p>
|
||||
<table width="90%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">Status</th>
|
||||
@@ -107,20 +119,22 @@
|
||||
</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>
|
||||
</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
|
||||
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>
|
||||
</p>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
{% if unmatchedworkouts %}
|
||||
<h2>Workouts that are not linked to any session</h2>
|
||||
<p>
|
||||
<table width="90%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -170,8 +184,9 @@ planned workouts by purchasing the "Coach" or "Self-Coach" plans.
|
||||
|
||||
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -14791,6 +14791,14 @@ def plannedsessions_view(request,
|
||||
},
|
||||
]
|
||||
|
||||
initial = {
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
}
|
||||
|
||||
dateform = DateRangeForm(initial=initial)
|
||||
|
||||
|
||||
return render(request,'plannedsessions.html',
|
||||
{
|
||||
'teams':get_my_teams(request.user),
|
||||
@@ -14798,6 +14806,7 @@ def plannedsessions_view(request,
|
||||
'plannedsessions':sps,
|
||||
'plan':trainingplan,
|
||||
'active': 'nav-plan',
|
||||
'dateform':dateform,
|
||||
'rower':r,
|
||||
'timeperiod':timeperiod,
|
||||
'completeness':completeness,
|
||||
|
||||
Reference in New Issue
Block a user