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