expanded boat types & classes
This commit is contained in:
@@ -36,6 +36,8 @@ from requests import Request, Session
|
|||||||
|
|
||||||
from utils import myqueue
|
from utils import myqueue
|
||||||
|
|
||||||
|
from rowers.types import otwtypes
|
||||||
|
|
||||||
from rowsandall_app.settings import C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET
|
from rowsandall_app.settings import C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET
|
||||||
|
|
||||||
from rowers.tasks import handle_c2_import_stroke_data
|
from rowers.tasks import handle_c2_import_stroke_data
|
||||||
@@ -340,7 +342,7 @@ def createc2workoutdata_as_splits(w):
|
|||||||
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
|
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
|
||||||
|
|
||||||
wtype = w.workouttype
|
wtype = w.workouttype
|
||||||
if wtype in ('other','coastal'):
|
if wtype in otwtypes:
|
||||||
wtype = 'water'
|
wtype = 'water'
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
@@ -404,7 +406,7 @@ def createc2workoutdata(w):
|
|||||||
durationstr = datetime.strptime(str(w.duration),"%H:%M:%S")
|
durationstr = datetime.strptime(str(w.duration),"%H:%M:%S")
|
||||||
|
|
||||||
workouttype = w.workouttype
|
workouttype = w.workouttype
|
||||||
if workouttype in ('coastal','other'):
|
if workouttype in otwtypes:
|
||||||
workouttype = 'water'
|
workouttype = 'water'
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ queuelow = django_rq.get_queue('low')
|
|||||||
queuehigh = django_rq.get_queue('default')
|
queuehigh = django_rq.get_queue('default')
|
||||||
|
|
||||||
from rowsandall_app.settings import SITE_URL
|
from rowsandall_app.settings import SITE_URL
|
||||||
|
from rowers.types import otwtypes
|
||||||
|
|
||||||
user = settings.DATABASES['default']['USER']
|
user = settings.DATABASES['default']['USER']
|
||||||
password = settings.DATABASES['default']['PASSWORD']
|
password = settings.DATABASES['default']['PASSWORD']
|
||||||
@@ -2355,7 +2355,7 @@ def workout_rscore(w):
|
|||||||
normp = (pwr4mean)**(0.25)
|
normp = (pwr4mean)**(0.25)
|
||||||
if not np.isnan(normp):
|
if not np.isnan(normp):
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if w.workouttype in ('water','coastal'):
|
if w.workouttype in otwtypes:
|
||||||
ftp = ftp*(100.-r.otwslack)/100.
|
ftp = ftp*(100.-r.otwslack)/100.
|
||||||
|
|
||||||
intensityfactor = pwrmean/float(ftp)
|
intensityfactor = pwrmean/float(ftp)
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ class TrendFlexModalForm(forms.Form):
|
|||||||
initial='all')
|
initial='all')
|
||||||
waterboattype = forms.MultipleChoiceField(choices=boattypes,
|
waterboattype = forms.MultipleChoiceField(choices=boattypes,
|
||||||
label='Water Boat Type',
|
label='Water Boat Type',
|
||||||
initial = ['1x','2x','2-','4x','4-','8+'])
|
initial = types.waterboattype)
|
||||||
|
|
||||||
|
|
||||||
# This form sets options for the summary stats page
|
# This form sets options for the summary stats page
|
||||||
@@ -531,15 +531,21 @@ class StatsOptionsForm(forms.Form):
|
|||||||
waterboattype = forms.MultipleChoiceField(choices=boattypes,
|
waterboattype = forms.MultipleChoiceField(choices=boattypes,
|
||||||
label='Water Boat Type',
|
label='Water Boat Type',
|
||||||
widget=forms.CheckboxSelectMultiple(),
|
widget=forms.CheckboxSelectMultiple(),
|
||||||
initial = ['1x','2x','2-','4x','4-','8+'])
|
initial = types.waterboattype)
|
||||||
rower = forms.BooleanField(initial=True,required=False)
|
def __init__(self, *args, **kwargs):
|
||||||
dynamic = forms.BooleanField(initial=True,required=False)
|
super(StatsOptionsForm, self).__init__(*args,**kwargs)
|
||||||
slides = forms.BooleanField(initial=True,required=False)
|
|
||||||
skierg = forms.BooleanField(initial=False,required=False)
|
for type in types.checktypes:
|
||||||
paddle = forms.BooleanField(initial=False,required=False)
|
self.fields[type] = forms.BooleanField(initial=True,required=False)
|
||||||
snow = forms.BooleanField(initial=False,required=False)
|
|
||||||
coastal = forms.BooleanField(initial=False,required=False)
|
# rower = forms.BooleanField(initial=True,required=False)
|
||||||
other = forms.BooleanField(initial=False,required=False)
|
# dynamic = forms.BooleanField(initial=True,required=False)
|
||||||
|
# slides = forms.BooleanField(initial=True,required=False)
|
||||||
|
# skierg = forms.BooleanField(initial=False,required=False)
|
||||||
|
# paddle = forms.BooleanField(initial=False,required=False)
|
||||||
|
# snow = forms.BooleanField(initial=False,required=False)
|
||||||
|
# coastal = forms.BooleanField(initial=False,required=False)
|
||||||
|
# other = forms.BooleanField(initial=False,required=False)
|
||||||
|
|
||||||
class CourseSelectForm(forms.Form):
|
class CourseSelectForm(forms.Form):
|
||||||
course = forms.ModelChoiceField(queryset=GeoCourse.objects.all())
|
course = forms.ModelChoiceField(queryset=GeoCourse.objects.all())
|
||||||
@@ -706,6 +712,8 @@ class WorkoutSessionSelectForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class RaceResultFilterForm(forms.Form):
|
class RaceResultFilterForm(forms.Form):
|
||||||
|
boatclasses = (type for type in types.workouttypes if type[0] in types.otwtypes)
|
||||||
|
boatclassinitial = [t for t in types.otwtypes]
|
||||||
sexchoices = (
|
sexchoices = (
|
||||||
('female','Female'),
|
('female','Female'),
|
||||||
('male','Male'),
|
('male','Male'),
|
||||||
@@ -724,10 +732,16 @@ class RaceResultFilterForm(forms.Form):
|
|||||||
label='Gender',
|
label='Gender',
|
||||||
widget=forms.CheckboxSelectMultiple())
|
widget=forms.CheckboxSelectMultiple())
|
||||||
|
|
||||||
|
boatclass = forms.MultipleChoiceField(
|
||||||
|
choices=boatclasses,
|
||||||
|
initial=boatclassinitial,
|
||||||
|
label='Boat Class',
|
||||||
|
widget=forms.CheckboxSelectMultiple())
|
||||||
|
|
||||||
boattype = forms.MultipleChoiceField(
|
boattype = forms.MultipleChoiceField(
|
||||||
choices=boattypes,
|
choices=boattypes,
|
||||||
label='Boat Type',
|
label='Boat Type',
|
||||||
initial=['1x','2x','2-','4x','4-','8+'],
|
initial=types.waterboattype,
|
||||||
widget=forms.CheckboxSelectMultiple())
|
widget=forms.CheckboxSelectMultiple())
|
||||||
|
|
||||||
age_min = forms.IntegerField(label='Min Age',initial=16)
|
age_min = forms.IntegerField(label='Min Age',initial=16)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from utils import myqueue
|
|||||||
import django_rq
|
import django_rq
|
||||||
queue = django_rq.get_queue('default')
|
queue = django_rq.get_queue('default')
|
||||||
from rowers.tasks import handle_updatefitnessmetric
|
from rowers.tasks import handle_updatefitnessmetric
|
||||||
|
from rowers.types import otwtypes
|
||||||
|
|
||||||
def getrower(user):
|
def getrower(user):
|
||||||
try:
|
try:
|
||||||
@@ -45,7 +46,7 @@ def do_update(user,mode='rower',days=42):
|
|||||||
else:
|
else:
|
||||||
workouts = Workout.objects.filter(
|
workouts = Workout.objects.filter(
|
||||||
user=r,
|
user=r,
|
||||||
workouttype__in=['water','coastal'],
|
workouttype__in=otwtypes,
|
||||||
startdatetime__gte=startdate)
|
startdatetime__gte=startdate)
|
||||||
|
|
||||||
theids = [int(w.id) for w in workouts]
|
theids = [int(w.id) for w in workouts]
|
||||||
|
|||||||
@@ -1602,6 +1602,7 @@ def auto_delete_strokedata_on_delete(sender, instance, **kwargs):
|
|||||||
|
|
||||||
# Virtual Race results (for keeping results when workouts are deleted)
|
# Virtual Race results (for keeping results when workouts are deleted)
|
||||||
class VirtualRaceResult(models.Model):
|
class VirtualRaceResult(models.Model):
|
||||||
|
boatclasses = (type for type in types.workouttypes if type[0] in types.otwtypes)
|
||||||
userid = models.IntegerField(default=0)
|
userid = models.IntegerField(default=0)
|
||||||
teamname = models.CharField(max_length=80,verbose_name = 'Team Name',
|
teamname = models.CharField(max_length=80,verbose_name = 'Team Name',
|
||||||
blank=True,null=True)
|
blank=True,null=True)
|
||||||
@@ -1613,6 +1614,10 @@ class VirtualRaceResult(models.Model):
|
|||||||
race = models.ForeignKey(VirtualRace)
|
race = models.ForeignKey(VirtualRace)
|
||||||
duration = models.TimeField(default=datetime.time(1,0))
|
duration = models.TimeField(default=datetime.time(1,0))
|
||||||
distance = models.IntegerField(default=0)
|
distance = models.IntegerField(default=0)
|
||||||
|
boatclass = models.CharField(choices=boatclasses,
|
||||||
|
max_length=40,
|
||||||
|
default='water',
|
||||||
|
verbose_name = 'Boat Class')
|
||||||
boattype = models.CharField(choices=boattypes,max_length=40,
|
boattype = models.CharField(choices=boattypes,max_length=40,
|
||||||
default='1x',
|
default='1x',
|
||||||
verbose_name = 'Boat Type'
|
verbose_name = 'Boat Type'
|
||||||
@@ -1649,7 +1654,7 @@ class CourseTestResult(models.Model):
|
|||||||
class VirtualRaceResultForm(ModelForm):
|
class VirtualRaceResultForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = VirtualRaceResult
|
model = VirtualRaceResult
|
||||||
fields = ['teamname','weightcategory','boattype','age']
|
fields = ['teamname','weightcategory','boatclass','boattype','age']
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
<th> </th>
|
<th> </th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
|
<th>Class</th>
|
||||||
<th>Boat</th>
|
<th>Boat</th>
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
<th>Distance</th>
|
<th>Distance</th>
|
||||||
@@ -123,6 +124,7 @@
|
|||||||
<td>{{ result.age }}</td>
|
<td>{{ result.age }}</td>
|
||||||
<td>{{ result.sex }}</td>
|
<td>{{ result.sex }}</td>
|
||||||
<td>{{ result.weightcategory }}</td>
|
<td>{{ result.weightcategory }}</td>
|
||||||
|
<td>{{ result.boatclass }}</td>
|
||||||
<td>{{ result.boattype }}</td>
|
<td>{{ result.boattype }}</td>
|
||||||
<td>{{ result.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
<td>{{ result.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
||||||
<td>{{ result.distance }} m</td>
|
<td>{{ result.distance }} m</td>
|
||||||
@@ -139,6 +141,7 @@
|
|||||||
<td>{{ result.age }}</td>
|
<td>{{ result.age }}</td>
|
||||||
<td>{{ result.sex }}</td>
|
<td>{{ result.sex }}</td>
|
||||||
<td>{{ result.weightcategory }}</td>
|
<td>{{ result.weightcategory }}</td>
|
||||||
|
<td>{{ result.boatclass }}</td>
|
||||||
<td>{{ result.boattype }}</td>
|
<td>{{ result.boattype }}</td>
|
||||||
<td>DNS</td>
|
<td>DNS</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -158,6 +161,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Team Name</th>
|
<th>Team Name</th>
|
||||||
|
<th>Class</th>
|
||||||
<th>Boat</th>
|
<th>Boat</th>
|
||||||
<th>Age</th>
|
<th>Age</th>
|
||||||
<th>Gender</th>
|
<th>Gender</th>
|
||||||
@@ -168,6 +172,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ record.username }}
|
<td>{{ record.username }}
|
||||||
<td>{{ record.teamname }}</td>
|
<td>{{ record.teamname }}</td>
|
||||||
|
<td>{{ record.boatclass }}</td>
|
||||||
<td>{{ record.boattype }}</td>
|
<td>{{ record.boattype }}</td>
|
||||||
<td>{{ record.age }}</td>
|
<td>{{ record.age }}</td>
|
||||||
<td>{{ record.sex }}</td>
|
<td>{{ record.sex }}</td>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
workouttypes = (
|
workouttypes = (
|
||||||
('water','On-water'),
|
('water','On-water - Olympic'),
|
||||||
('rower','Indoor Rower'),
|
('rower','Indoor Rower'),
|
||||||
('skierg','Ski Erg'),
|
('skierg','Ski Erg'),
|
||||||
('dynamic','Dynamic Indoor Rower'),
|
('dynamic','Dynamic Indoor Rower'),
|
||||||
@@ -7,9 +7,20 @@ workouttypes = (
|
|||||||
('paddle','Paddle Adapter'),
|
('paddle','Paddle Adapter'),
|
||||||
('snow','On-snow'),
|
('snow','On-snow'),
|
||||||
('coastal','Coastal'),
|
('coastal','Coastal'),
|
||||||
|
('c-boat','Dutch C boat'),
|
||||||
|
('churchboat','Finnish Church boat'),
|
||||||
('other','Other'),
|
('other','Other'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
otwtypes = (
|
||||||
|
'water',
|
||||||
|
'coastal',
|
||||||
|
'c-boat',
|
||||||
|
'churchboat'
|
||||||
|
)
|
||||||
|
|
||||||
|
checktypes = [i[0] for i in workouttypes]
|
||||||
|
|
||||||
workoutsources = (
|
workoutsources = (
|
||||||
('strava','strava'),
|
('strava','strava'),
|
||||||
('concept2','concept2'),
|
('concept2','concept2'),
|
||||||
@@ -36,12 +47,20 @@ workoutsources = (
|
|||||||
boattypes = (
|
boattypes = (
|
||||||
('1x', '1x (single)'),
|
('1x', '1x (single)'),
|
||||||
('2x', '2x (double)'),
|
('2x', '2x (double)'),
|
||||||
|
('2x+', '2x+ (coxed double)'),
|
||||||
('2-', '2- (pair)'),
|
('2-', '2- (pair)'),
|
||||||
|
('2+', '2+ (coxed pair)'),
|
||||||
|
('3x+','3x+ (coxed triple)'),
|
||||||
('4x', '4x (quad)'),
|
('4x', '4x (quad)'),
|
||||||
|
('4x+', '4x+ (coxed quad)'),
|
||||||
('4-', '4- (four)'),
|
('4-', '4- (four)'),
|
||||||
|
('4+', '4+ (coxed four)'),
|
||||||
('8+', '8+ (eight)'),
|
('8+', '8+ (eight)'),
|
||||||
|
('8x+', '8x+ (octuple scull)'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
waterboattype = [i[0] for i in boattypes]
|
||||||
|
|
||||||
privacychoices = (
|
privacychoices = (
|
||||||
('private','Private'),
|
('private','Private'),
|
||||||
('visible','Visible'),
|
('visible','Visible'),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ queue = django_rq.get_queue('default')
|
|||||||
queuelow = django_rq.get_queue('low')
|
queuelow = django_rq.get_queue('low')
|
||||||
queuehigh = django_rq.get_queue('low')
|
queuehigh = django_rq.get_queue('low')
|
||||||
|
|
||||||
from types import workouttypes,boattypes
|
from types import workouttypes,boattypes,otwtypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
@@ -297,7 +297,7 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
|||||||
r.pw_tr,r.pw_an])/r.ftp
|
r.pw_tr,r.pw_an])/r.ftp
|
||||||
|
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if w.workouttype in ('water','coastal'):
|
if w.workouttype in otwtypes:
|
||||||
ftp = ftp*(100.-r.otwslack)/100.
|
ftp = ftp*(100.-r.otwslack)/100.
|
||||||
|
|
||||||
hrpwrdata = {
|
hrpwrdata = {
|
||||||
@@ -322,7 +322,7 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
|||||||
if plotnr == 0:
|
if plotnr == 0:
|
||||||
plotnr = plotnrs[plottype]
|
plotnr = plotnrs[plottype]
|
||||||
|
|
||||||
if w.workouttype in ('water','coastal'):
|
if w.workouttype in otwtypes:
|
||||||
plotnr = plotnr+3
|
plotnr = plotnr+3
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
114
rowers/views.py
114
rowers/views.py
@@ -606,7 +606,7 @@ def get_thumbnails(request,id):
|
|||||||
aantalcomments = len(comments)
|
aantalcomments = len(comments)
|
||||||
|
|
||||||
workouttype = 'ote'
|
workouttype = 'ote'
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
workouttype = 'otw'
|
workouttype = 'otw'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -1330,7 +1330,7 @@ def add_workout_from_runkeeperdata(user,importid,data):
|
|||||||
times_location = times_distance
|
times_location = times_distance
|
||||||
latcoord = np.zeros(len(times_distance))
|
latcoord = np.zeros(len(times_distance))
|
||||||
loncoord = np.zeros(len(times_distance))
|
loncoord = np.zeros(len(times_distance))
|
||||||
if workouttype in ('water','coastal'):
|
if workouttype in types.otwtypes:
|
||||||
workouttype = 'rower'
|
workouttype = 'rower'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -1511,7 +1511,7 @@ def add_workout_from_stdata(user,importid,data):
|
|||||||
times_location = times_distance
|
times_location = times_distance
|
||||||
latcoord = np.zeros(len(times_distance))
|
latcoord = np.zeros(len(times_distance))
|
||||||
loncoord = np.zeros(len(times_distance))
|
loncoord = np.zeros(len(times_distance))
|
||||||
if workouttype in ('water','coastal'):
|
if workouttype in types.otwtypes:
|
||||||
workouttype = 'rower'
|
workouttype = 'rower'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -1682,7 +1682,7 @@ def add_workout_from_underarmourdata(user,importid,data):
|
|||||||
times_location = times_distance
|
times_location = times_distance
|
||||||
latcoord = np.zeros(len(times_distance))
|
latcoord = np.zeros(len(times_distance))
|
||||||
loncoord = np.zeros(len(times_distance))
|
loncoord = np.zeros(len(times_distance))
|
||||||
if workouttype in ('water','coastal'):
|
if workouttype in types.otwtypes:
|
||||||
workouttype = 'rower'
|
workouttype = 'rower'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -2886,8 +2886,8 @@ def histo_all(request,theuser=0,
|
|||||||
enddatestring="",
|
enddatestring="",
|
||||||
options={
|
options={
|
||||||
'includereststrokes':False,
|
'includereststrokes':False,
|
||||||
'workouttypes':['rower','dynamic','slides'],
|
'workouttypes':[i[0] for i in types.workouttypes],
|
||||||
'waterboattype':['1x','2x','2-','4x','4-','8+']
|
'waterboattype':types.waterboattype
|
||||||
}):
|
}):
|
||||||
|
|
||||||
if 'options' in request.session:
|
if 'options' in request.session:
|
||||||
@@ -2899,8 +2899,8 @@ def histo_all(request,theuser=0,
|
|||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
|
|
||||||
checktypes = ['water','rower','dynamic','slides','skierg',
|
# checktypes = ['water','rower','dynamic','slides','skierg',
|
||||||
'paddle','snow','coastal','other']
|
# 'paddle','snow','coastal','other']
|
||||||
|
|
||||||
|
|
||||||
if deltadays>0:
|
if deltadays>0:
|
||||||
@@ -2972,8 +2972,8 @@ def cum_flex_data(
|
|||||||
request,
|
request,
|
||||||
options={
|
options={
|
||||||
'includereststrokes':False,
|
'includereststrokes':False,
|
||||||
'workouttypes':['rower','dynamic','slides'],
|
'workouttypes':[i[0] for i in types.workouttypes],
|
||||||
'waterboattype':['1x','2x','2-','4x','4-','8+'],
|
'waterboattype':types.waterboattype,
|
||||||
'theuser':0,
|
'theuser':0,
|
||||||
'xparam':'spm',
|
'xparam':'spm',
|
||||||
'yparam1':'power',
|
'yparam1':'power',
|
||||||
@@ -3072,8 +3072,8 @@ def cum_flex(request,theuser=0,
|
|||||||
enddatestring="",
|
enddatestring="",
|
||||||
options={
|
options={
|
||||||
'includereststrokes':False,
|
'includereststrokes':False,
|
||||||
'workouttypes':['rower','dynamic','slides'],
|
'workouttypes':[i[0] for i in types.workouttypes],
|
||||||
'waterboattype':['1x','2x','2-','4x','4-','8+']
|
'waterboattype':types.waterboattype
|
||||||
}):
|
}):
|
||||||
|
|
||||||
if 'options' in request.session:
|
if 'options' in request.session:
|
||||||
@@ -3082,7 +3082,7 @@ def cum_flex(request,theuser=0,
|
|||||||
try:
|
try:
|
||||||
workouttypes = options['workouttypes']
|
workouttypes = options['workouttypes']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
workouttypes = ['rower','dynamic','slides']
|
workouttypes = [i[0] for i in types.workouttypes]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
includereststrokes = options['includereststrokes']
|
includereststrokes = options['includereststrokes']
|
||||||
@@ -3092,13 +3092,13 @@ def cum_flex(request,theuser=0,
|
|||||||
try:
|
try:
|
||||||
waterboattype = options['waterboattype']
|
waterboattype = options['waterboattype']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
|
|
||||||
checktypes = ['water','rower','dynamic','slides','skierg',
|
# checktypes = ['water','rower','dynamic','slides','skierg',
|
||||||
'paddle','snow','coastal','other']
|
# 'paddle','snow','coastal','other']
|
||||||
|
|
||||||
|
|
||||||
if deltadays>0:
|
if deltadays>0:
|
||||||
@@ -3176,7 +3176,7 @@ def cum_flex(request,theuser=0,
|
|||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||||
workouttypes = []
|
workouttypes = []
|
||||||
for type in checktypes:
|
for type in types.checktypes:
|
||||||
if optionsform.cleaned_data[type]:
|
if optionsform.cleaned_data[type]:
|
||||||
workouttypes.append(type)
|
workouttypes.append(type)
|
||||||
|
|
||||||
@@ -3222,7 +3222,7 @@ def cum_flex(request,theuser=0,
|
|||||||
|
|
||||||
initial['waterboattype'] = waterboattype
|
initial['waterboattype'] = waterboattype
|
||||||
|
|
||||||
for wtype in checktypes:
|
for wtype in types.checktypes:
|
||||||
if wtype in workouttypes:
|
if wtype in workouttypes:
|
||||||
initial[wtype] = True
|
initial[wtype] = True
|
||||||
else:
|
else:
|
||||||
@@ -3409,8 +3409,8 @@ def histo(request,theuser=0,
|
|||||||
enddatestring="",
|
enddatestring="",
|
||||||
options={
|
options={
|
||||||
'includereststrokes':False,
|
'includereststrokes':False,
|
||||||
'workouttypes':['water','rower','dynamic','slides'],
|
'workouttypes':[i[0] for i in types.workouttypes],
|
||||||
'waterboattype':['1x','2x','2-','4x','4-','8+']
|
'waterboattype':types.waterboattype
|
||||||
}):
|
}):
|
||||||
|
|
||||||
if 'options' in request.session:
|
if 'options' in request.session:
|
||||||
@@ -3421,15 +3421,15 @@ def histo(request,theuser=0,
|
|||||||
includereststrokes = options['includereststrokes']
|
includereststrokes = options['includereststrokes']
|
||||||
waterboattype = options['waterboattype']
|
waterboattype = options['waterboattype']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
workouttypes = ['water','rower','dynamic','slides']
|
workouttypes = [i[0] for i in types.workouttypes]
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
includereststrokes = False
|
includereststrokes = False
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
|
|
||||||
checktypes = ['water','rower','dynamic','slides','skierg',
|
# checktypes = ['water','rower','dynamic','slides','skierg',
|
||||||
'paddle','snow','coastal','other']
|
# 'paddle','snow','coastal','other']
|
||||||
|
|
||||||
if deltadays>0:
|
if deltadays>0:
|
||||||
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
||||||
@@ -3499,7 +3499,7 @@ def histo(request,theuser=0,
|
|||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||||
workouttypes = []
|
workouttypes = []
|
||||||
for type in checktypes:
|
for type in types.checktypes:
|
||||||
if optionsform.cleaned_data[type]:
|
if optionsform.cleaned_data[type]:
|
||||||
workouttypes.append(type)
|
workouttypes.append(type)
|
||||||
|
|
||||||
@@ -3564,7 +3564,7 @@ def histo(request,theuser=0,
|
|||||||
|
|
||||||
initial['waterboattype'] = waterboattype
|
initial['waterboattype'] = waterboattype
|
||||||
|
|
||||||
for wtype in checktypes:
|
for wtype in types.checktypes:
|
||||||
if wtype in workouttypes:
|
if wtype in workouttypes:
|
||||||
initial[wtype] = True
|
initial[wtype] = True
|
||||||
else:
|
else:
|
||||||
@@ -4476,7 +4476,7 @@ def workout_update_cp_view(request,id=0):
|
|||||||
|
|
||||||
dataprep.runcpupdate(r)
|
dataprep.runcpupdate(r)
|
||||||
|
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
url = reverse(otwrankings_view)
|
url = reverse(otwrankings_view)
|
||||||
else:
|
else:
|
||||||
url = reverse(oterankings_view)
|
url = reverse(oterankings_view)
|
||||||
@@ -5297,7 +5297,7 @@ def workouts_join_select(request,
|
|||||||
if 'waterboattype' in request.session:
|
if 'waterboattype' in request.session:
|
||||||
waterboattype = request.session['waterboattype']
|
waterboattype = request.session['waterboattype']
|
||||||
else:
|
else:
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
|
|
||||||
|
|
||||||
if 'modalities' in request.session:
|
if 'modalities' in request.session:
|
||||||
@@ -5456,7 +5456,7 @@ def team_comparison_select(request,
|
|||||||
if 'waterboattype' in request.session:
|
if 'waterboattype' in request.session:
|
||||||
waterboattype = request.session['waterboattype']
|
waterboattype = request.session['waterboattype']
|
||||||
else:
|
else:
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
|
|
||||||
|
|
||||||
if 'modalities' in request.session:
|
if 'modalities' in request.session:
|
||||||
@@ -5720,7 +5720,7 @@ def user_multiflex_select(request,
|
|||||||
if 'waterboattype' in request.session:
|
if 'waterboattype' in request.session:
|
||||||
waterboattype = request.session['waterboattype']
|
waterboattype = request.session['waterboattype']
|
||||||
else:
|
else:
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
|
|
||||||
|
|
||||||
if 'modalities' in request.session:
|
if 'modalities' in request.session:
|
||||||
@@ -6214,7 +6214,7 @@ def user_boxplot_select(request,
|
|||||||
options={
|
options={
|
||||||
'includereststrokes':False,
|
'includereststrokes':False,
|
||||||
'workouttypes':['rower','dynamic','slides'],
|
'workouttypes':['rower','dynamic','slides'],
|
||||||
'waterboattype':['1x','2x','2-','4x','4-','8+']
|
'waterboattype':types.waterboattype
|
||||||
},
|
},
|
||||||
userid=0):
|
userid=0):
|
||||||
|
|
||||||
@@ -6238,9 +6238,9 @@ def user_boxplot_select(request,
|
|||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
checktypes = ['water','rower','dynamic','slides','skierg',
|
# checktypes = ['water','rower','dynamic','slides','skierg',
|
||||||
'paddle','snow','other','coastal']
|
# 'paddle','snow','other','coastal']
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
|
|
||||||
if 'startdate' in request.session:
|
if 'startdate' in request.session:
|
||||||
startdate = iso8601.parse_date(request.session['startdate'])
|
startdate = iso8601.parse_date(request.session['startdate'])
|
||||||
@@ -6287,7 +6287,7 @@ def user_boxplot_select(request,
|
|||||||
if optionsform.is_valid():
|
if optionsform.is_valid():
|
||||||
workouttypes = []
|
workouttypes = []
|
||||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||||
for type in checktypes:
|
for type in types.checktypes:
|
||||||
if optionsform.cleaned_data[type]:
|
if optionsform.cleaned_data[type]:
|
||||||
workouttypes.append(type)
|
workouttypes.append(type)
|
||||||
|
|
||||||
@@ -6361,7 +6361,7 @@ def user_boxplot_select(request,
|
|||||||
initial = {}
|
initial = {}
|
||||||
initial['waterboattype'] = waterboattype
|
initial['waterboattype'] = waterboattype
|
||||||
|
|
||||||
for wtype in checktypes:
|
for wtype in types.checktypes:
|
||||||
if wtype in workouttypes:
|
if wtype in workouttypes:
|
||||||
initial[wtype] = True
|
initial[wtype] = True
|
||||||
else:
|
else:
|
||||||
@@ -7617,7 +7617,7 @@ def workout_geeky_view(request,id=0,message="",successmessage=""):
|
|||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
|
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
return render(request,
|
return render(request,
|
||||||
'otwgeeky.html',
|
'otwgeeky.html',
|
||||||
{'workout':row,
|
{'workout':row,
|
||||||
@@ -7702,7 +7702,7 @@ def cumstats(request,theuser=0,
|
|||||||
options={
|
options={
|
||||||
'includereststrokes':False,
|
'includereststrokes':False,
|
||||||
'workouttypes':['rower','dynamic','slides'],
|
'workouttypes':['rower','dynamic','slides'],
|
||||||
'waterboattype':['1x','2x','2-','4x','4-','8+']
|
'waterboattype':types.waterboattype
|
||||||
}):
|
}):
|
||||||
|
|
||||||
if 'options' in request.session:
|
if 'options' in request.session:
|
||||||
@@ -7722,9 +7722,9 @@ def cumstats(request,theuser=0,
|
|||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
checktypes = ['water','rower','dynamic','slides','skierg',
|
# checktypes = ['water','rower','dynamic','slides','skierg',
|
||||||
'paddle','snow','other','coastal']
|
# 'paddle','snow','other','coastal']
|
||||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
waterboattype = types.waterboattype
|
||||||
|
|
||||||
if deltadays>0:
|
if deltadays>0:
|
||||||
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
||||||
@@ -7800,7 +7800,7 @@ def cumstats(request,theuser=0,
|
|||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
workouttypes = []
|
workouttypes = []
|
||||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||||
for type in checktypes:
|
for type in types.checktypes:
|
||||||
if optionsform.cleaned_data[type]:
|
if optionsform.cleaned_data[type]:
|
||||||
workouttypes.append(type)
|
workouttypes.append(type)
|
||||||
|
|
||||||
@@ -7952,7 +7952,7 @@ def cumstats(request,theuser=0,
|
|||||||
initial['includereststrokes'] = includereststrokes
|
initial['includereststrokes'] = includereststrokes
|
||||||
initial['waterboattype'] = waterboattype
|
initial['waterboattype'] = waterboattype
|
||||||
|
|
||||||
for wtype in checktypes:
|
for wtype in types.checktypes:
|
||||||
if wtype in workouttypes:
|
if wtype in workouttypes:
|
||||||
initial[wtype] = True
|
initial[wtype] = True
|
||||||
else:
|
else:
|
||||||
@@ -8172,7 +8172,7 @@ def workout_advanced_view(request,id=0,message="",successmessage=""):
|
|||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
|
|
||||||
|
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
return render(request,
|
return render(request,
|
||||||
'advancedotw.html',
|
'advancedotw.html',
|
||||||
{'workout':row,
|
{'workout':row,
|
||||||
@@ -8436,7 +8436,7 @@ def workout_workflow_view(request,id):
|
|||||||
aantalcomments = len(comments)
|
aantalcomments = len(comments)
|
||||||
|
|
||||||
workouttype = 'ote'
|
workouttype = 'ote'
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
workouttype = 'otw'
|
workouttype = 'otw'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -8528,7 +8528,7 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
mayedit=1
|
mayedit=1
|
||||||
|
|
||||||
workouttype = 'ote'
|
workouttype = 'ote'
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
workouttype = 'otw'
|
workouttype = 'otw'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -8686,7 +8686,7 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
noylist = ["time","distance"]
|
noylist = ["time","distance"]
|
||||||
axchoicesbasic.pop("cumdist")
|
axchoicesbasic.pop("cumdist")
|
||||||
|
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
for name,d in rowingmetrics:
|
for name,d in rowingmetrics:
|
||||||
if d['mode'] == 'erg':
|
if d['mode'] == 'erg':
|
||||||
axchoicespro.pop(name)
|
axchoicespro.pop(name)
|
||||||
@@ -10961,7 +10961,7 @@ def workout_summary_restore_view(request,id,message="",successmessage=""):
|
|||||||
r.pw_tr,r.pw_an])/r.ftp
|
r.pw_tr,r.pw_an])/r.ftp
|
||||||
|
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
ftp = ftp*(100.-r.otwslack)/100.
|
ftp = ftp*(100.-r.otwslack)/100.
|
||||||
|
|
||||||
rr = rrower(hrmax=r.max,hrut2=r.ut2,
|
rr = rrower(hrmax=r.max,hrut2=r.ut2,
|
||||||
@@ -11147,7 +11147,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
r.pw_tr,r.pw_an])/r.ftp
|
r.pw_tr,r.pw_an])/r.ftp
|
||||||
|
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
ftp = ftp*(100.-r.otwslack)/100.
|
ftp = ftp*(100.-r.otwslack)/100.
|
||||||
|
|
||||||
rr = rrower(hrmax=r.max,hrut2=r.ut2,
|
rr = rrower(hrmax=r.max,hrut2=r.ut2,
|
||||||
@@ -11907,7 +11907,7 @@ def strokedatajson(request,id):
|
|||||||
r.pw_tr,r.pw_an])/r.ftp
|
r.pw_tr,r.pw_an])/r.ftp
|
||||||
|
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if row.workouttype in ('water','coastal'):
|
if row.workouttype in types.otwtypes:
|
||||||
ftp = ftp*(100.-r.otwslack)/100.
|
ftp = ftp*(100.-r.otwslack)/100.
|
||||||
|
|
||||||
rr = rrower(hrmax=r.max,hrut2=r.ut2,
|
rr = rrower(hrmax=r.max,hrut2=r.ut2,
|
||||||
@@ -13644,6 +13644,7 @@ def virtualevent_view(request,id=0):
|
|||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
sex = cd['sex']
|
sex = cd['sex']
|
||||||
boattype = cd['boattype']
|
boattype = cd['boattype']
|
||||||
|
boatclass = cd['boatclass']
|
||||||
age_min = cd['age_min']
|
age_min = cd['age_min']
|
||||||
age_max = cd['age_max']
|
age_max = cd['age_max']
|
||||||
weightcategory = cd['weightcategory']
|
weightcategory = cd['weightcategory']
|
||||||
@@ -13651,6 +13652,7 @@ def virtualevent_view(request,id=0):
|
|||||||
results = VirtualRaceResult.objects.filter(
|
results = VirtualRaceResult.objects.filter(
|
||||||
race=race,
|
race=race,
|
||||||
workoutid__isnull=False,
|
workoutid__isnull=False,
|
||||||
|
boatclass__in=boatclass,
|
||||||
boattype__in=boattype,
|
boattype__in=boattype,
|
||||||
sex__in=sex,
|
sex__in=sex,
|
||||||
weightcategory__in=weightcategory,
|
weightcategory__in=weightcategory,
|
||||||
@@ -13664,6 +13666,7 @@ def virtualevent_view(request,id=0):
|
|||||||
dns = VirtualRaceResult.objects.filter(
|
dns = VirtualRaceResult.objects.filter(
|
||||||
race=race,
|
race=race,
|
||||||
workoutid__isnull=True,
|
workoutid__isnull=True,
|
||||||
|
boatclass__in=boatclass,
|
||||||
boattype__in=boattype,
|
boattype__in=boattype,
|
||||||
sex__in=sex,
|
sex__in=sex,
|
||||||
weightcategory__in=weightcategory,
|
weightcategory__in=weightcategory,
|
||||||
@@ -13752,6 +13755,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
)
|
)
|
||||||
|
|
||||||
boattypes = [record.boattype for record in records]
|
boattypes = [record.boattype for record in records]
|
||||||
|
boatclasses = [record.boatclass for record in records]
|
||||||
allowedboats = tuple([ type for type in types.boattypes if type[0] not in boattypes] )
|
allowedboats = tuple([ type for type in types.boattypes if type[0] not in boattypes] )
|
||||||
|
|
||||||
|
|
||||||
@@ -13763,6 +13767,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
teamname = cd['teamname']
|
teamname = cd['teamname']
|
||||||
boattype = cd['boattype']
|
boattype = cd['boattype']
|
||||||
|
boatclass = cd['boatclass']
|
||||||
weightcategory = cd['weightcategory']
|
weightcategory = cd['weightcategory']
|
||||||
age = cd['age']
|
age = cd['age']
|
||||||
mix = cd['mix']
|
mix = cd['mix']
|
||||||
@@ -13778,8 +13783,8 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
if sex == 'not specified':
|
if sex == 'not specified':
|
||||||
sex = 'male'
|
sex = 'male'
|
||||||
|
|
||||||
if boattype in boattypes:
|
if boattype in boattypes and boatclass in boatclasses:
|
||||||
messages.error(request,"You have already registered in that boat type")
|
messages.error(request,"You have already registered in that boat class/type")
|
||||||
url = reverse(virtualevent_view,
|
url = reverse(virtualevent_view,
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'id': race.id
|
'id': race.id
|
||||||
@@ -13799,6 +13804,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
weightcategory=weightcategory,
|
weightcategory=weightcategory,
|
||||||
duration=datetime.time(0,0),
|
duration=datetime.time(0,0),
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
|
boatclass=boatclass,
|
||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age
|
age=age
|
||||||
@@ -13828,7 +13834,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
'weightcategory': r.weightcategory,
|
'weightcategory': r.weightcategory,
|
||||||
}
|
}
|
||||||
|
|
||||||
form = VirtualRaceResultForm(initial=initial,boattypes=allowedboats)
|
form = VirtualRaceResultForm(initial=initial)
|
||||||
|
|
||||||
return render(request,'virtualeventregister.html',
|
return render(request,'virtualeventregister.html',
|
||||||
{
|
{
|
||||||
@@ -13864,6 +13870,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
teamname = cd['teamname']
|
teamname = cd['teamname']
|
||||||
boattype = cd['boattype']
|
boattype = cd['boattype']
|
||||||
|
boatclass = cd['boatclass']
|
||||||
weightcategory = cd['weightcategory']
|
weightcategory = cd['weightcategory']
|
||||||
age = cd['age']
|
age = cd['age']
|
||||||
mix = cd['mix']
|
mix = cd['mix']
|
||||||
@@ -13889,6 +13896,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
),
|
),
|
||||||
weightcategory=weightcategory,
|
weightcategory=weightcategory,
|
||||||
duration=datetime.time(0,0),
|
duration=datetime.time(0,0),
|
||||||
|
boatclass=boatclass,
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
|
|||||||
Reference in New Issue
Block a user