Merge branch 'feature/planningnav' into develop
This commit is contained in:
@@ -738,7 +738,10 @@ def fetchcp(rower,theworkouts,table='cpdata'):
|
||||
|
||||
|
||||
# create a new workout from manually entered data
|
||||
def create_row_df(r,distance,duration,startdatetime,workouttype='rower'):
|
||||
def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
|
||||
avghr=None,avgpwr=None,avgspm=None,
|
||||
rankingpiece = False,
|
||||
title='Manual entry',notes='',weightcategory='hwt'):
|
||||
|
||||
|
||||
|
||||
@@ -751,11 +754,14 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower'):
|
||||
totalseconds += duration.second
|
||||
totalseconds += duration.microsecond/1.e6
|
||||
|
||||
try:
|
||||
spm = 60.*nr_strokes/totalseconds
|
||||
except ZeroDivisionError:
|
||||
spm = 20.
|
||||
|
||||
if not avgspm:
|
||||
try:
|
||||
spm = 60.*nr_strokes/totalseconds
|
||||
except ZeroDivisionError:
|
||||
spm = 20.
|
||||
else:
|
||||
spm = avgspm
|
||||
|
||||
step = totalseconds/float(nr_strokes)
|
||||
|
||||
elapsed = np.arange(nr_strokes)*totalseconds/(float(nr_strokes-1))
|
||||
@@ -774,9 +780,15 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower'):
|
||||
except ZeroDivisionError:
|
||||
velo = 2.4
|
||||
power = 2.8*velo**3
|
||||
elif avgpwr is not None:
|
||||
power = avgpwr
|
||||
else:
|
||||
power = 0
|
||||
|
||||
if avghr is not None:
|
||||
hr = avghr
|
||||
else:
|
||||
hr = 0
|
||||
|
||||
df = pd.DataFrame({
|
||||
'TimeStamp (sec)': unixtime,
|
||||
@@ -785,6 +797,7 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower'):
|
||||
' Stroke500mPace (sec/500m)':pace,
|
||||
' ElapsedTime (sec)':elapsed,
|
||||
' Power (watts)':power,
|
||||
' HRCur (bpm)':hr,
|
||||
})
|
||||
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
@@ -797,10 +810,11 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower'):
|
||||
row.write_csv(csvfilename, gzip = True)
|
||||
|
||||
id, message = save_workout_database(csvfilename, r,
|
||||
# title=title,
|
||||
# notes=notes,
|
||||
title=title,
|
||||
notes=notes,
|
||||
rankingpiece=rankingpiece,
|
||||
dosmooth=False,
|
||||
# workouttype=workouttype,
|
||||
workouttype=workouttype,
|
||||
consistencychecks=False,
|
||||
totaltime=totalseconds)
|
||||
|
||||
@@ -814,6 +828,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
dosummary=True, title='Workout',
|
||||
workoutsource='unknown',
|
||||
notes='', totaldist=0, totaltime=0,
|
||||
rankingpiece=False,
|
||||
summary='',
|
||||
makeprivate=False,
|
||||
oarlength=2.89, inboard=0.88,
|
||||
@@ -1000,6 +1015,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
weightcategory=r.weightcategory,
|
||||
starttime=workoutstarttime,
|
||||
workoutsource=workoutsource,
|
||||
rankingpiece=rankingpiece,
|
||||
forceunit=forceunit,
|
||||
csvfilename=f2, notes=notes, summary=summary,
|
||||
maxhr=maxhr, averagehr=averagehr,
|
||||
@@ -1014,10 +1030,6 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
w.startdatetime = timezone.now()
|
||||
w.save()
|
||||
|
||||
if is_ranking_piece(w):
|
||||
w.rankingpiece = True
|
||||
w.save()
|
||||
|
||||
if privacy == 'visible':
|
||||
ts = Team.objects.filter(rower=r)
|
||||
for t in ts:
|
||||
@@ -1028,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,
|
||||
|
||||
@@ -30,7 +30,11 @@ class EmailForm(forms.Form):
|
||||
botcheck = forms.CharField(max_length=5)
|
||||
message = forms.CharField()
|
||||
|
||||
|
||||
|
||||
class MetricsForm(forms.Form):
|
||||
avghr = forms.IntegerField(required=False,label='Average Heart Rate')
|
||||
avgpwr = forms.IntegerField(required=False,label='Average Power')
|
||||
avgspm = forms.FloatField(required=False,label='Average SPM')
|
||||
|
||||
# Upload the CrewNerd Summary CSV
|
||||
class CNsummaryForm(forms.Form):
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
from django.utils import timezone
|
||||
from rowers.models import Workout, PowerTimeFitnessMetric, Rower
|
||||
import datetime
|
||||
|
||||
@@ -2067,7 +2067,7 @@ class Workout(models.Model):
|
||||
user = models.ForeignKey(Rower)
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
plannedsession = models.ForeignKey(PlannedSession, blank=True,null=True)
|
||||
name = models.CharField(max_length=150)
|
||||
name = models.CharField(max_length=150,blank=True,null=True)
|
||||
date = models.DateField()
|
||||
workouttype = models.CharField(choices=workouttypes,max_length=50,
|
||||
verbose_name='Exercise/Boat Class')
|
||||
|
||||
@@ -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()):
|
||||
@@ -400,12 +401,22 @@ def remove_rower_session(r,ps):
|
||||
|
||||
return 1
|
||||
|
||||
def get_dates_timeperiod(timeperiod,startdatestring='',enddatestring=''):
|
||||
def get_dates_timeperiod(request,startdatestring='',enddatestring=''):
|
||||
# set start end date according timeperiod
|
||||
|
||||
timeperiod = request.GET.get('when')
|
||||
|
||||
if not timeperiod:
|
||||
timeperiod = 'thisweek'
|
||||
|
||||
|
||||
startdatestring = request.GET.get('startdate')
|
||||
enddatestring = request.GET.get('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
|
||||
|
||||
daterangetester = re.compile('^(\d+-\d+-\d+)\/(\d+-\d+-\d+)')
|
||||
|
||||
if timeperiod=='today':
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
E408191@CZ27LT9RCGN72.15176:1541580768
|
||||
@@ -36,7 +36,7 @@ $('#id_workouttype').change();
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<h1>Add Workout Manually</h1>
|
||||
<h1>Add Manual Workout Entry</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
{% if form.errors %}
|
||||
@@ -49,6 +49,7 @@ $('#id_workouttype').change();
|
||||
enctype="multipart/form-data" action="" method="post">
|
||||
<table width=100%>
|
||||
{{ form.as_table }}
|
||||
{{ metricsform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<li>
|
||||
<a href="/rowers/workout/upload/"><i class="fas fa-file-upload fa-fw"></i> Upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/rowers/workout/addmanual/"><i class="fas fa-file-plus fa-fw"></i> Add manual entry</a>
|
||||
</li>
|
||||
<li>
|
||||
{% if user|is_promember %}
|
||||
<a href="/rowers/workouts-join-select">
|
||||
|
||||
@@ -8,6 +8,16 @@
|
||||
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
<ul class="main-content">
|
||||
<li>
|
||||
<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_4">
|
||||
<p>
|
||||
On this page, you can create and edit sessions for an entire time
|
||||
|
||||
@@ -8,8 +8,34 @@
|
||||
<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">
|
||||
<h1>New Session</h1>
|
||||
<form enctype="multipart/form-data" action=""
|
||||
method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ form.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input class="button green" type="submit" value="Save">
|
||||
</form>
|
||||
<div class="padded" id="id_guidance">
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Plan</h1>
|
||||
<p>
|
||||
@@ -59,24 +85,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>New Session</h1>
|
||||
<form enctype="multipart/form-data" action=""
|
||||
method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ form.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input class="button green" type="submit" value="Save">
|
||||
</form>
|
||||
<div class="padded" id="id_guidance">
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -6,16 +6,27 @@
|
||||
|
||||
{% block main %}
|
||||
<h1>Edit Session</h1>
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
{% endif %}
|
||||
|
||||
<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">
|
||||
<h2>{{ thesession.name }}</h2>
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
<p>
|
||||
<a href="/rowers/sessions/teamedit/{{ thesession.id }}/">
|
||||
Assign to my Teams
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
|
||||
@@ -8,170 +8,185 @@
|
||||
|
||||
<h1>Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
{% 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 align="left">Status</th>
|
||||
<th align="left">On or After</th>
|
||||
<th align="left">On or Before</th>
|
||||
<th align="left">Name</th>
|
||||
<th align="left">Type</th>
|
||||
<th align="left">Mode</th>
|
||||
<th align="left">Edit</th>
|
||||
<th align="left">Planned</th>
|
||||
<th align="left">Actual</th>
|
||||
<th align="left"> </th>
|
||||
<th align="left">Completion Date</th>
|
||||
<th align="left">
|
||||
</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/session/{{ ps.id }}/user/{{ rower.user.id }}/?when={{ timeperiod }}">
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="white dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </a>
|
||||
{% endif %}
|
||||
{% elif completeness|lookup:ps.id == 'completed' %}
|
||||
{% if ps.sessiontype != 'race' %}
|
||||
<a class="green dot"
|
||||
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}/?when={{ timeperiod }}"> </a>
|
||||
{% else %}
|
||||
<a class="green dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </a>
|
||||
{% endif %}
|
||||
{% elif completeness|lookup:ps.id == 'partial' %}
|
||||
{% if ps.sessiontype != 'race' %}
|
||||
<a class="orange dot"
|
||||
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}?when={{ timeperiod }}"> </a>
|
||||
{% else %}
|
||||
<a class="orange dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if ps.sessiontype != 'race' %}
|
||||
<a class="red dot"
|
||||
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}?when={{ timeperiod }}"> </a>
|
||||
{% else %}
|
||||
<a class="red dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </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 %}
|
||||
|
||||
{% 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"><em> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</em></td>
|
||||
{% else %}
|
||||
<td> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</td>
|
||||
<ul class="main-content">
|
||||
<li>
|
||||
<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_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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">Status</th>
|
||||
<th align="left">On or After</th>
|
||||
<th align="left">On or Before</th>
|
||||
<th align="left">Name</th>
|
||||
<th align="left">Type</th>
|
||||
<th align="left">Mode</th>
|
||||
<th align="left">Edit</th>
|
||||
<th align="left">Planned</th>
|
||||
<th align="left">Actual</th>
|
||||
<th align="left"> </th>
|
||||
<th align="left">Completion Date</th>
|
||||
<th align="left">
|
||||
</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/session/{{ ps.id }}/user/{{ rower.user.id }}/?when={{ timeperiod }}">
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="white dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </a>
|
||||
{% endif %}
|
||||
{% elif completeness|lookup:ps.id == 'completed' %}
|
||||
{% if ps.sessiontype != 'race' %}
|
||||
<a class="green dot"
|
||||
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}/?when={{ timeperiod }}"> </a>
|
||||
{% else %}
|
||||
<a class="green dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </a>
|
||||
{% endif %}
|
||||
{% elif completeness|lookup:ps.id == 'partial' %}
|
||||
{% if ps.sessiontype != 'race' %}
|
||||
<a class="orange dot"
|
||||
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}?when={{ timeperiod }}"> </a>
|
||||
{% else %}
|
||||
<a class="orange dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if ps.sessiontype != 'race' %}
|
||||
<a class="red dot"
|
||||
href="/rowers/sessions/manage/session/{{ ps.id }}/user/{{ rower.user.id }}?when={{ timeperiod }}"> </a>
|
||||
{% else %}
|
||||
<a class="red dot" href="/rowers/virtualevent/{{ ps.id }}/submit"> </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 %}
|
||||
|
||||
{% 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"><em> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</em></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
|
||||
href="/rowers/sessions/print/user/{{ rower.user.id }}/?when={{ timeperiod }}">
|
||||
Print View</a>
|
||||
</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>
|
||||
<th style="width:80"> Date</th>
|
||||
<th align="left"> Time</th>
|
||||
<th align="left"> Name</th>
|
||||
<th align="left"> Type</th>
|
||||
<th align="left"> Distance </th>
|
||||
<th align="left"> Duration </th>
|
||||
<th align="left"> Avg HR </th>
|
||||
<th align="left"> Max HR </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for workout in unmatchedworkouts %}
|
||||
<tr>
|
||||
<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 %}
|
||||
</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
|
||||
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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:80"> Date</th>
|
||||
<th align="left"> Time</th>
|
||||
<th align="left"> Name</th>
|
||||
<th align="left"> Type</th>
|
||||
<th align="left"> Distance </th>
|
||||
<th align="left"> Duration </th>
|
||||
<th align="left"> Avg HR </th>
|
||||
<th align="left"> Max HR </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for workout in unmatchedworkouts %}
|
||||
<tr>
|
||||
<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 %}
|
||||
</p>
|
||||
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -66,6 +66,15 @@
|
||||
|
||||
<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">
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
<h1>Coach Overview</h1>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="get">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
<input type="Submit" value="Set Date Range">
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
<table width="90%" class="listtable">
|
||||
<thead>
|
||||
|
||||
@@ -19,6 +19,16 @@
|
||||
{% 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,
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
{% 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>
|
||||
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
|
||||
@@ -6,6 +6,17 @@
|
||||
|
||||
{% 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>
|
||||
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
</p>
|
||||
|
||||
<p>Want to add race results but you don't have stroke data?
|
||||
<a href="/rowers/addmanual">Click here.</a></p>
|
||||
<a href="/rowers/workout/addmanual">Click here.</a></p>
|
||||
|
||||
<p>Scroll down for the chart and pace predictions for ranking pieces.</p>
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ urlpatterns = [
|
||||
url(r'^list-workouts/$',views.workouts_view),
|
||||
url(r'^list-courses/$',views.courses_view),
|
||||
url(r'^courses/upload$',views.course_upload_view),
|
||||
url(r'^addmanual/$',views.addmanual_view),
|
||||
url(r'^workout/addmanual/$',views.addmanual_view),
|
||||
url(r'^team-compare-select/workout/(?P<id>\d+)/team/(?P<teamid>\d+)/user/(?P<userid>\d+)/$',views.team_comparison_select),
|
||||
url(r'^team-compare-select/team/(?P<teamid>\d+)/(?P<startdatestring>\d+-\d+-\d+)/(?P<enddatestring>\d+-\d+-\d+)/user/(?P<userid>\d+)/$',views.team_comparison_select),
|
||||
url(r'^team-compare-select/team/(?P<teamid>\d+)/(?P<startdatestring>\d+-\d+-\d+)/(?P<enddatestring>\d+-\d+-\d+)$',views.team_comparison_select),
|
||||
|
||||
165
rowers/views.py
165
rowers/views.py
@@ -49,6 +49,7 @@ from rowers.forms import (
|
||||
VirtualRaceSelectForm,WorkoutRaceSelectForm,CourseSelectForm,
|
||||
RaceResultFilterForm,PowerIntervalUpdateForm,FlexAxesForm,
|
||||
FlexOptionsForm,DataFrameColumnsForm,OteWorkoutTypeForm,
|
||||
MetricsForm,
|
||||
)
|
||||
from django.core.urlresolvers import reverse, reverse_lazy
|
||||
|
||||
@@ -3294,12 +3295,26 @@ def histo(request,theuser=0,
|
||||
def addmanual_view(request):
|
||||
r = Rower.objects.get(user=request.user)
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts',
|
||||
'name':'Workouts'
|
||||
},
|
||||
{
|
||||
'url':reverse(addmanual_view),
|
||||
'name': 'Add Manual Entry'
|
||||
},
|
||||
]
|
||||
|
||||
if request.method == 'POST':
|
||||
# Form was submitted
|
||||
form = WorkoutForm(request.POST)
|
||||
if form.is_valid():
|
||||
metricsform = MetricsForm(request.POST)
|
||||
if form.is_valid() and metricsform.is_valid():
|
||||
# Get values from form
|
||||
name = form.cleaned_data['name']
|
||||
if name == '':
|
||||
name = 'Manual Entry'
|
||||
date = form.cleaned_data['date']
|
||||
starttime = form.cleaned_data['starttime']
|
||||
workouttype = form.cleaned_data['workouttype']
|
||||
@@ -3309,6 +3324,9 @@ def addmanual_view(request):
|
||||
notes = form.cleaned_data['notes']
|
||||
thetimezone = form.cleaned_data['timezone']
|
||||
private = form.cleaned_data['private']
|
||||
avghr = metricsform.cleaned_data['avghr']
|
||||
avgpwr = metricsform.cleaned_data['avgpwr']
|
||||
avgspm = metricsform.cleaned_data['avgspm']
|
||||
try:
|
||||
boattype = request.POST['boattype']
|
||||
except KeyError:
|
||||
@@ -3336,12 +3354,17 @@ def addmanual_view(request):
|
||||
)
|
||||
|
||||
|
||||
|
||||
id,message = dataprep.create_row_df(r,
|
||||
distance,
|
||||
# weightcategory,
|
||||
duration,startdatetime,
|
||||
# title = name,
|
||||
# notes=notes,
|
||||
weightcategory=weightcategory,
|
||||
avghr=avghr,
|
||||
rankingpiece=rankingpiece,
|
||||
avgpwr=avgpwr,
|
||||
avgspm=avgspm,
|
||||
title = name,
|
||||
notes=notes,
|
||||
workouttype=workouttype)
|
||||
|
||||
|
||||
@@ -3351,7 +3374,7 @@ def addmanual_view(request):
|
||||
|
||||
if id:
|
||||
w = Workout.objects.get(id=id)
|
||||
w.rankingpiece = rankingpiece or is_ranking_piece(w)
|
||||
w.rankingpiece = rankingpiece
|
||||
w.privacy = privacy
|
||||
w.weightcategory = weightcategory
|
||||
w.notes = notes
|
||||
@@ -3360,7 +3383,13 @@ def addmanual_view(request):
|
||||
w.boattype = boattype
|
||||
w.save()
|
||||
messages.info(request,'New workout created')
|
||||
|
||||
else:
|
||||
return render(request,'manualadd.html',
|
||||
{'form':form,
|
||||
'metricsform':metricsform,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'active':'nav-workouts',
|
||||
})
|
||||
|
||||
initial = {
|
||||
'workouttype':'rower',
|
||||
@@ -3372,9 +3401,12 @@ def addmanual_view(request):
|
||||
|
||||
}
|
||||
form = WorkoutForm(initial=initial)
|
||||
metricsform = MetricsForm()
|
||||
|
||||
return render(request,'manualadd.html',
|
||||
{'form':form,
|
||||
'metricsform':metricsform,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'active':'nav-workouts',
|
||||
})
|
||||
|
||||
@@ -13961,8 +13993,8 @@ def plannedsession_multiclone_view(
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
|
||||
if request.method == 'POST' and 'daterange' in request.POST:
|
||||
@@ -14059,6 +14091,11 @@ def plannedsession_multiclone_view(
|
||||
'name': 'Clone Multiple Sessions'
|
||||
}
|
||||
]
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
return render(request, 'plannedsessions_multiclone_select.html',
|
||||
{'plannedsessions':sps,
|
||||
@@ -14088,8 +14125,8 @@ def plannedsession_create_view(request,
|
||||
|
||||
|
||||
|
||||
when = request.GET.get('when')
|
||||
startdate,enddate = get_dates_timeperiod(when,startdatestring=startdatestring,
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(request,startdatestring=startdatestring,
|
||||
enddatestring=enddatestring)
|
||||
|
||||
|
||||
@@ -14195,11 +14232,17 @@ def plannedsession_create_view(request,
|
||||
trainingplan = None
|
||||
|
||||
timeperiod = startdate.strftime('%Y-%m-%d')+'/'+enddate.strftime('%Y-%m-%d')
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
return render(request,'plannedsessioncreate.html',
|
||||
{
|
||||
'teams':get_my_teams(request.user),
|
||||
'plan':trainingplan,
|
||||
'dateform':dateform,
|
||||
'form':sessioncreateform,
|
||||
'active':'nav-plan',
|
||||
'plannedsessions':sps,
|
||||
@@ -14217,8 +14260,8 @@ def plannedsession_multicreate_view(request,
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
startdate__lte = startdate,
|
||||
@@ -14298,17 +14341,24 @@ def plannedsession_multicreate_view(request,
|
||||
}
|
||||
]
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate
|
||||
})
|
||||
|
||||
context = {
|
||||
'ps_formset':ps_formset,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'rower':r,
|
||||
'active':'nav-plan',
|
||||
'dateform':dateform,
|
||||
'plan':trainingplan,
|
||||
'timeperiod':timeperiod,
|
||||
'teams':get_my_teams(request.user),
|
||||
'extrasessions': extrasessions+1
|
||||
}
|
||||
|
||||
|
||||
return render(request,'plannedsession_multicreate.html',context)
|
||||
|
||||
# Manager creates sessions for entire team
|
||||
@@ -14319,7 +14369,7 @@ def plannedsession_teamcreate_view(request,
|
||||
|
||||
therower = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
|
||||
teams = Team.objects.filter(manager=request.user)
|
||||
if len(teams)>0:
|
||||
@@ -14330,7 +14380,7 @@ def plannedsession_teamcreate_view(request,
|
||||
url = reverse(rower_teams_view)
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
trainingplan = None
|
||||
|
||||
@@ -14444,11 +14494,17 @@ def plannedsession_teamcreate_view(request,
|
||||
'name': 'Add Team Session'
|
||||
}
|
||||
]
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
return render(request,'plannedsessionteamcreate.html',
|
||||
{
|
||||
'teams':get_my_teams(request.user),
|
||||
'plan':trainingplan,
|
||||
'dateform':dateform,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'form':sessioncreateform,
|
||||
'teamform':sessionteamselectform,
|
||||
@@ -14466,7 +14522,7 @@ def plannedsession_teamedit_view(request,
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
|
||||
try:
|
||||
ps = PlannedSession.objects.get(id=sessionid)
|
||||
@@ -14480,7 +14536,7 @@ def plannedsession_teamedit_view(request,
|
||||
|
||||
teaminitial = ps.team.all()
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
@@ -14589,12 +14645,17 @@ def plannedsession_teamedit_view(request,
|
||||
'name': 'Add Team Session'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
return render(request,'plannedsessionteamedit.html',
|
||||
{
|
||||
'plannedsession':ps,
|
||||
'plan':trainingplan,
|
||||
'dateform':dateform,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'rower':r,
|
||||
'active':'nav-plan',
|
||||
@@ -14614,9 +14675,9 @@ def plannedsessions_coach_view(request,
|
||||
|
||||
therower = getrower(request.user)
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
|
||||
trainingplan = None
|
||||
@@ -14678,6 +14739,11 @@ def plannedsessions_coach_view(request,
|
||||
}
|
||||
]
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
return render(request,'plannedsessionscoach.html',
|
||||
{
|
||||
'myteams':myteams,
|
||||
@@ -14685,6 +14751,7 @@ def plannedsessions_coach_view(request,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'plan':trainingplan,
|
||||
'statusdict':statusdict,
|
||||
'dateform':dateform,
|
||||
'timeperiod':timeperiod,
|
||||
'rowers':rowers,
|
||||
'rower':therower,
|
||||
@@ -14714,9 +14781,11 @@ def plannedsessions_view(request,
|
||||
pass
|
||||
|
||||
|
||||
when = request.GET.get('when')
|
||||
startdate,enddate = get_dates_timeperiod(when,startdatestring=startdatestring,
|
||||
enddatestring=enddatestring)
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(
|
||||
request,
|
||||
startdatestring=startdatestring,
|
||||
enddatestring=enddatestring)
|
||||
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
@@ -14757,6 +14826,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),
|
||||
@@ -14764,6 +14841,7 @@ def plannedsessions_view(request,
|
||||
'plannedsessions':sps,
|
||||
'plan':trainingplan,
|
||||
'active': 'nav-plan',
|
||||
'dateform':dateform,
|
||||
'rower':r,
|
||||
'timeperiod':timeperiod,
|
||||
'completeness':completeness,
|
||||
@@ -14777,9 +14855,9 @@ def plannedsessions_print_view(request,userid=0):
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
@@ -14817,11 +14895,11 @@ def plannedsessions_manage_view(request,userid=0,
|
||||
if request.is_ajax():
|
||||
is_ajax = True
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
@@ -14944,11 +15022,19 @@ def plannedsessions_manage_view(request,userid=0,
|
||||
'name': 'Link Sessions to Workouts'
|
||||
},
|
||||
]
|
||||
|
||||
timeperiod = startdate.strftime('%Y-%m-%d')+'/'+enddate.strftime('%Y-%m-%d')
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
return render(request,'plannedsessionsmanage.html',
|
||||
{
|
||||
'teams':get_my_teams(request.user),
|
||||
'plan':trainingplan,
|
||||
'dateform':dateform,
|
||||
'plannedsessions':sps,
|
||||
'workouts':ws,
|
||||
'active':'nav-plan',
|
||||
@@ -14969,13 +15055,13 @@ def plannedsession_clone_view(request,id=0,userid=0):
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
if when:
|
||||
timeperiod = when
|
||||
else:
|
||||
timeperiod = 'thisweek'
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
@@ -15033,13 +15119,9 @@ def plannedsession_edit_view(request,id=0,userid=0):
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
if when:
|
||||
timeperiod = when
|
||||
else:
|
||||
timeperiod = 'thisweek'
|
||||
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
|
||||
try:
|
||||
@@ -15129,6 +15211,13 @@ def plannedsession_edit_view(request,id=0,userid=0):
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
timeperiod = startdate.strftime('%Y-%m-%d')+'/'+enddate.strftime('%Y-%m-%d')
|
||||
|
||||
return render(request,'plannedsessionedit.html',
|
||||
{
|
||||
@@ -15139,6 +15228,7 @@ def plannedsession_edit_view(request,id=0,userid=0):
|
||||
'active':'nav-plan',
|
||||
'plannedsessions':sps,
|
||||
'thesession':ps,
|
||||
'dateform':dateform,
|
||||
'rower':r,
|
||||
'timeperiod':timeperiod,
|
||||
})
|
||||
@@ -15150,7 +15240,7 @@ def plannedsession_view(request,id=0,userid=0):
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
when = request.GET.get('when')
|
||||
|
||||
|
||||
try:
|
||||
ps = PlannedSession.objects.get(id=id)
|
||||
@@ -15258,7 +15348,7 @@ def plannedsession_view(request,id=0,userid=0):
|
||||
|
||||
# if coursetest, need to reorder the ranking
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
try:
|
||||
trainingplan = TrainingPlan.objects.filter(
|
||||
startdate__lte = startdate,
|
||||
@@ -16593,9 +16683,10 @@ def rower_trainingplan_view(request,
|
||||
thismacroid=0,
|
||||
thismesoid=0):
|
||||
|
||||
|
||||
when = request.GET.get('when')
|
||||
if when:
|
||||
startdate,enddate = get_dates_timeperiod(when)
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
else:
|
||||
startdate = datetime.date.today()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user