Private
Public Access
1
0

Merge branch 'develop' into feature/braintree

This commit is contained in:
Sander Roosendaal
2018-12-15 15:52:01 +01:00
10 changed files with 142 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ class RowerInline(admin.StackedInline):
{'fields':('rowerplan','paymenttype','planexpires','teamplanexpires','clubsize','protrialexpires','plantrialexpires',)}), {'fields':('rowerplan','paymenttype','planexpires','teamplanexpires','clubsize','protrialexpires','plantrialexpires',)}),
('Rower Settings', ('Rower Settings',
{'fields': {'fields':
('gdproptin','gdproptindate','weightcategory','sex','birthdate','getemailnotifications', ('gdproptin','gdproptindate','weightcategory','sex','adaptiveclass','birthdate','getemailnotifications',
'getimportantemails','emailbounced','defaultlandingpage', 'getimportantemails','emailbounced','defaultlandingpage',
'defaulttimezone','showfavoritechartnotes')}), 'defaulttimezone','showfavoritechartnotes')}),
('Rower Zones', ('Rower Zones',

View File

@@ -140,6 +140,7 @@ def workout_summary_to_df(
distances = [] distances = []
durations = [] durations = []
weightcategories = [] weightcategories = []
adaptivetypes = []
weightvalues = [] weightvalues = []
notes = [] notes = []
tcx_links = [] tcx_links = []
@@ -155,6 +156,7 @@ def workout_summary_to_df(
distances.append(w.distance) distances.append(w.distance)
durations.append(w.duration) durations.append(w.duration)
weightcategories.append(w.weightcategory) weightcategories.append(w.weightcategory)
adaptivetypes.append(w.adaptiveclass)
weightvalues.append(w.weightvalue) weightvalues.append(w.weightvalue)
notes.append(w.notes) notes.append(w.notes)
tcx_link = SITE_URL+'/rowers/workout/{id}/emailtcx'.format( tcx_link = SITE_URL+'/rowers/workout/{id}/emailtcx'.format(
@@ -177,6 +179,7 @@ def workout_summary_to_df(
'distance (m)':distances, 'distance (m)':distances,
'duration ':durations, 'duration ':durations,
'weight category':weightcategories, 'weight category':weightcategories,
'adaptive classification':adaptivetypes,
'weight (kg)':weightvalues, 'weight (kg)':weightvalues,
'notes':notes, 'notes':notes,
'Stroke Data TCX':tcx_links, 'Stroke Data TCX':tcx_links,
@@ -742,7 +745,8 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
avghr=None,avgpwr=None,avgspm=None, avghr=None,avgpwr=None,avgspm=None,
rankingpiece = False, rankingpiece = False,
duplicate=False, duplicate=False,
title='Manual entry',notes='',weightcategory='hwt'): title='Manual entry',notes='',weightcategory='hwt',
adaptiveclass='None'):
if duration is not None: if duration is not None:
totalseconds = duration.hour*3600. totalseconds = duration.hour*3600.
@@ -832,6 +836,8 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
dosmooth=False, dosmooth=False,
workouttype=workouttype, workouttype=workouttype,
consistencychecks=False, consistencychecks=False,
weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
totaltime=totalseconds) totaltime=totalseconds)
return (id, message) return (id, message)
@@ -841,6 +847,8 @@ from utils import totaltime_sec_to_string
# Processes painsled CSV file to database # Processes painsled CSV file to database
def save_workout_database(f2, r, dosmooth=True, workouttype='rower', def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
boattype='1x', boattype='1x',
adaptiveclass='None',
weightcategory='hwt',
dosummary=True, title='Workout', dosummary=True, title='Workout',
workoutsource='unknown', workoutsource='unknown',
notes='', totaldist=0, totaltime=0, notes='', totaldist=0, totaltime=0,
@@ -1046,7 +1054,8 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
workouttype=workouttype, workouttype=workouttype,
boattype=boattype, boattype=boattype,
duration=duration, distance=totaldist, duration=duration, distance=totaldist,
weightcategory=r.weightcategory, weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
starttime=workoutstarttime, starttime=workoutstarttime,
duplicate=duplicate, duplicate=duplicate,
workoutsource=workoutsource, workoutsource=workoutsource,
@@ -1328,6 +1337,8 @@ def new_workout_from_file(r, f2,
id, message = save_workout_database( id, message = save_workout_database(
f2, r, f2, r,
workouttype=workouttype, workouttype=workouttype,
weightcategory=r.weightcategory,
adaptiveclass=r.adaptiveclass,
boattype=boattype, boattype=boattype,
makeprivate=makeprivate, makeprivate=makeprivate,
dosummary=dosummary, dosummary=dosummary,

View File

@@ -579,6 +579,8 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
('lwt','light-weight'), ('lwt','light-weight'),
) )
adaptivecategories = mytypes.adaptivetypes
thisyear = timezone.now().year thisyear = timezone.now().year
birthdate = forms.DateTimeField( birthdate = forms.DateTimeField(
@@ -592,6 +594,7 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
age = (timezone.now() - dob).days/365 age = (timezone.now() - dob).days/365
if age < 16: if age < 16:
raise forms.ValidationError('Must be at least 16 years old to register') raise forms.ValidationError('Must be at least 16 years old to register')
return self.cleaned_data['birthdate']
sex = forms.ChoiceField(required=True, sex = forms.ChoiceField(required=True,
choices=sexcategories, choices=sexcategories,
@@ -601,6 +604,9 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
weightcategory = forms.ChoiceField(label='Weight Category', weightcategory = forms.ChoiceField(label='Weight Category',
choices=weightcategories) choices=weightcategories)
adaptiveclass = forms.ChoiceField(label='Adaptive Classification',
choices=adaptivecategories)
# def __init__(self, *args, **kwargs): # def __init__(self, *args, **kwargs):
# self.fields['sex'].initial = 'not specified' # self.fields['sex'].initial = 'not specified'
@@ -891,6 +897,7 @@ class RaceResultFilterForm(forms.Form):
('lwt','light-weight'), ('lwt','light-weight'),
) )
adaptivecategories = mytypes.adaptivetypes
sex = forms.MultipleChoiceField( sex = forms.MultipleChoiceField(
choices=sexchoices, choices=sexchoices,
@@ -919,6 +926,12 @@ class RaceResultFilterForm(forms.Form):
initial=['hwt','lwt'], initial=['hwt','lwt'],
widget=forms.CheckboxSelectMultiple()) widget=forms.CheckboxSelectMultiple())
adaptivecategory = forms.MultipleChoiceField(
choices=adaptivecategories,
label='Adaptive Class',
initial=['None','PR1','PR2','PR3','FES'],
widget=forms.CheckboxSelectMultiple())
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if 'records' in kwargs: if 'records' in kwargs:
records = kwargs.pop('records',None) records = kwargs.pop('records',None)
@@ -980,7 +993,20 @@ class RaceResultFilterForm(forms.Form):
if choice[0] in theweightcategoryes: if choice[0] in theweightcategoryes:
weightcategorychoices.append(choice) weightcategorychoices.append(choice)
self.fields['weightcategory'].choices = weightcategorychoices self.fields['weightcategory'].choices = weightcategorychoices
# adaptivecategory
theadaptivecategoryes = [record.adaptiveclass for record in records]
theadaptivecategoryes = list(set(theadaptivecategoryes))
if len(theadaptivecategoryes)<= 1:
del self.fields['adaptivecategory']
else:
adaptivecategorychoices = []
for choice in self.fields['adaptivecategory'].choices:
if choice[0] in theadaptivecategoryes:
adaptivecategorychoices.append(choice)
self.fields['adaptivecategory'].choices = adaptivecategorychoices
class WorkoutRaceSelectForm(forms.Form): class WorkoutRaceSelectForm(forms.Form):
# evaluate_after = forms.TimeField( # evaluate_after = forms.TimeField(
# input_formats=['%H:%M:%S.%f', # input_formats=['%H:%M:%S.%f',

View File

@@ -538,7 +538,7 @@ weightcategories = (
# Extension of User with rowing specific data # Extension of User with rowing specific data
class Rower(models.Model): class Rower(models.Model):
adaptivetypes = mytypes.adaptivetypes
stravatypes = ( stravatypes = (
('Ride','Ride'), ('Ride','Ride'),
('Kitesurf','Kitesurf'), ('Kitesurf','Kitesurf'),
@@ -593,6 +593,10 @@ class Rower(models.Model):
max_length=30, max_length=30,
choices=sexcategories) choices=sexcategories)
adaptiveclass = models.CharField(choices=adaptivetypes,max_length=50,
default='None',
verbose_name='Adaptive Classification')
birthdate = models.DateField(null=True,blank=True) birthdate = models.DateField(null=True,blank=True)
# Power Zone Data # Power Zone Data
ftp = models.IntegerField(default=226,verbose_name="Functional Threshold Power") ftp = models.IntegerField(default=226,verbose_name="Functional Threshold Power")
@@ -2256,6 +2260,7 @@ class Workout(models.Model):
workouttypes = mytypes.workouttypes workouttypes = mytypes.workouttypes
workoutsources = mytypes.workoutsources workoutsources = mytypes.workoutsources
privacychoices = mytypes.privacychoices privacychoices = mytypes.privacychoices
adaptivetypes = mytypes.adaptivetypes
user = models.ForeignKey(Rower) user = models.ForeignKey(Rower)
team = models.ManyToManyField(Team,blank=True) team = models.ManyToManyField(Team,blank=True)
@@ -2270,6 +2275,9 @@ class Workout(models.Model):
boattype = models.CharField(choices=boattypes,max_length=50, boattype = models.CharField(choices=boattypes,max_length=50,
default='1x', default='1x',
verbose_name = 'Boat Type') verbose_name = 'Boat Type')
adaptiveclass = models.CharField(choices=adaptivetypes,max_length=50,
default='None',
verbose_name='Adaptive Classification')
starttime = models.TimeField(blank=True,null=True) starttime = models.TimeField(blank=True,null=True)
startdatetime = models.DateTimeField(blank=True,null=True) startdatetime = models.DateTimeField(blank=True,null=True)
timezone = models.CharField(default='UTC', timezone = models.CharField(default='UTC',
@@ -2426,6 +2434,9 @@ class VirtualRaceResult(models.Model):
weightcategory = models.CharField(default="hwt",max_length=10, weightcategory = models.CharField(default="hwt",max_length=10,
choices=weightcategories, choices=weightcategories,
verbose_name='Weight Category') verbose_name='Weight Category')
adaptiveclass = models.CharField(default="None",max_length=50,
choices=mytypes.adaptivetypes,
verbose_name="Adaptive Class")
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)
@@ -2482,6 +2493,9 @@ class IndoorVirtualRaceResult(models.Model):
weightcategory = models.CharField(default="hwt",max_length=10, weightcategory = models.CharField(default="hwt",max_length=10,
choices=weightcategories, choices=weightcategories,
verbose_name='Weight Category') verbose_name='Weight Category')
adaptiveclass = models.CharField(default="None",max_length=50,
choices=mytypes.adaptivetypes,
verbose_name="Adaptive Class")
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)
@@ -2533,7 +2547,7 @@ class CourseTestResult(models.Model):
class IndoorVirtualRaceResultForm(ModelForm): class IndoorVirtualRaceResultForm(ModelForm):
class Meta: class Meta:
model = IndoorVirtualRaceResult model = IndoorVirtualRaceResult
fields = ['teamname','weightcategory','boatclass','age'] fields = ['teamname','weightcategory','boatclass','age','adaptiveclass']
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@@ -2543,7 +2557,8 @@ class IndoorVirtualRaceResultForm(ModelForm):
class VirtualRaceResultForm(ModelForm): class VirtualRaceResultForm(ModelForm):
class Meta: class Meta:
model = VirtualRaceResult model = VirtualRaceResult
fields = ['teamname','weightcategory','boatclass','boattype','age'] fields = ['teamname','weightcategory','boatclass','boattype',
'age','adaptiveclass']
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@@ -2683,7 +2698,20 @@ class WorkoutForm(ModelForm):
# duration = forms.TimeInput(format='%H:%M:%S.%f') # duration = forms.TimeInput(format='%H:%M:%S.%f')
class Meta: class Meta:
model = Workout model = Workout
fields = ['name','date','starttime','timezone','duration','distance','workouttype','boattype','weightcategory','notes','rankingpiece','duplicate','plannedsession'] fields = ['name',
'date',
'starttime',
'timezone',
'duration',
'distance',
'workouttype',
'boattype',
'weightcategory',
'adaptiveclass',
'notes',
'rankingpiece',
'duplicate',
'plannedsession']
widgets = { widgets = {
'date': AdminDateWidget(), 'date': AdminDateWidget(),
'notes': forms.Textarea, 'notes': forms.Textarea,
@@ -2930,6 +2958,7 @@ class AccountRowerForm(ModelForm):
class Meta: class Meta:
model = Rower model = Rower
fields = ['sex','birthdate','weightcategory', fields = ['sex','birthdate','weightcategory',
'adaptiveclass',
'getemailnotifications', 'getemailnotifications',
'getimportantemails', 'getimportantemails',
'defaulttimezone','showfavoritechartnotes', 'defaulttimezone','showfavoritechartnotes',

View File

@@ -283,6 +283,14 @@ boattypes = (
('8x+', '8x+ (octuple scull)'), ('8x+', '8x+ (octuple scull)'),
) )
adaptivetypes = (
('None','None'),
('PR1', 'PR1 (Arms and Shoulders)'),
('PR2', 'PR2 (Trunk and Arms)'),
('PR3', 'PR3 (Leg Trunk and Arms)'),
('FES', 'FES (Functional Electrical Stimulation)'),
)
waterboattype = [i[0] for i in boattypes] waterboattype = [i[0] for i in boattypes]
privacychoices = ( privacychoices = (

View File

@@ -1025,6 +1025,10 @@ def add_workout_indoorrace(ws,race,r,recordid=0):
errors.append('Your workout weight category did not match the weight category you registered') errors.append('Your workout weight category did not match the weight category you registered')
return 0,comments, errors,0 return 0,comments, errors,0
if ws[0].adaptiveclass != record.adaptiveclass:
errors.append('Your adaptive classification did not match the registration')
return 0,comments, errors, 0
# start adding sessions # start adding sessions
if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime: if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime:
ws[0].plannedsession = race ws[0].plannedsession = race
@@ -1129,6 +1133,10 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
errors.append('Your workout weight category did not match the weight category you registered') errors.append('Your workout weight category did not match the weight category you registered')
return 0,comments, errors,0 return 0,comments, errors,0
if ws[0].adaptiveclass != record.adaptiveclass:
errors.append('Your workout adaptive classification did not match the registration')
return 0,comments, errors,0
# start adding sessions # start adding sessions
if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime: if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime:
ws[0].plannedsession = race ws[0].plannedsession = race

View File

@@ -79,6 +79,7 @@ class WorkoutSerializer(serializers.ModelSerializer):
duration=validated_data['duration'], duration=validated_data['duration'],
distance=validated_data['distance'], distance=validated_data['distance'],
weightcategory=r.weightcategory, weightcategory=r.weightcategory,
adaptiveclass=r.adaptiveclass,
starttime=validated_data['starttime'], starttime=validated_data['starttime'],
csvfilename='', csvfilename='',
notes=validated_data['notes'], notes=validated_data['notes'],

View File

@@ -244,6 +244,7 @@
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th>
{% if race.sessiontype == 'race' %} {% if race.sessiontype == 'race' %}
<th>Class</th> <th>Class</th>
<th>Boat</th> <th>Boat</th>
@@ -265,6 +266,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.adaptiveclass }}</td>
{% if race.sessiontype == 'race' %} {% if race.sessiontype == 'race' %}
<td>{{ result.boatclass }}</td> <td>{{ result.boatclass }}</td>
<td>{{ result.boattype }}</td> <td>{{ result.boattype }}</td>
@@ -293,6 +295,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.adaptiveclass }}</td>
{% if race.sessiontype == 'race' %} {% if race.sessiontype == 'race' %}
<td>{{ result.boatclass }}</td> <td>{{ result.boatclass }}</td>
<td>{{ result.boattype }}</td> <td>{{ result.boattype }}</td>
@@ -344,6 +347,7 @@
<th>Age</th> <th>Age</th>
<th>Gender</th> <th>Gender</th>
<th>Weight Category</th> <th>Weight Category</th>
<th>Adaptive</th>
</tr> </tr>
<tbody> <tbody>
{% for record in records %} {% for record in records %}
@@ -359,6 +363,7 @@
<td>{{ record.age }}</td> <td>{{ record.age }}</td>
<td>{{ record.sex }}</td> <td>{{ record.sex }}</td>
<td>{{ record.weightcategory }}</td> <td>{{ record.weightcategory }}</td>
<td>{{ record.adaptiveclass }}</td>
{% if record.userid == rower.id and 'withdrawbutton' in buttons %} {% if record.userid == rower.id and 'withdrawbutton' in buttons %}
<td> <td>
<a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a> <a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a>

View File

@@ -968,6 +968,7 @@ class NewUserRegistrationTest(TestCase):
'password2':'aapindewei2', 'password2':'aapindewei2',
'tos':True, 'tos':True,
'weightcategory':'hwt', 'weightcategory':'hwt',
'adaptiveclass': 'None',
'sex':'male', 'sex':'male',
'next':'/rowers/list-workouts', 'next':'/rowers/list-workouts',
'birthdate':datetime.datetime(year=1970,month=4,day=2) 'birthdate':datetime.datetime(year=1970,month=4,day=2)
@@ -1161,6 +1162,7 @@ class DataTest(TestCase):
'distance':8000, 'distance':8000,
'notes':'Aap noot \n mies', 'notes':'Aap noot \n mies',
'weightcategory':'lwt', 'weightcategory':'lwt',
'adaptiveclass': 'PR1',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x', 'boattype':'1x',
'private':False, 'private':False,
@@ -1392,6 +1394,7 @@ class ViewTest(TestCase):
'duration':'1:00:00.5', 'duration':'1:00:00.5',
'distance':'15000', 'distance':'15000',
'weightcategory':'hwt', 'weightcategory':'hwt',
'adaptiveclass':'PR1',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x', 'boattype':'1x',
'private':True, 'private':True,

View File

@@ -1115,6 +1115,8 @@ def checkouts_view(request):
def rower_register_view(request): def rower_register_view(request):
nextpage = request.GET.get('next','/rowers/list-workouts/') nextpage = request.GET.get('next','/rowers/list-workouts/')
if nextpage == '':
nextpage = '/rowers/list-workouts/'
if request.method == 'POST': if request.method == 'POST':
#form = RegistrationFormUniqueEmail(request.POST) #form = RegistrationFormUniqueEmail(request.POST)
@@ -1128,6 +1130,7 @@ def rower_register_view(request):
sex = form.cleaned_data['sex'] sex = form.cleaned_data['sex']
birthdate = form.cleaned_data['birthdate'] birthdate = form.cleaned_data['birthdate']
weightcategory = form.cleaned_data['weightcategory'] weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
nextpage = request.POST['next'] nextpage = request.POST['next']
theuser = User.objects.create_user(username,password=password) theuser = User.objects.create_user(username,password=password)
theuser.first_name = first_name theuser.first_name = first_name
@@ -1136,7 +1139,8 @@ def rower_register_view(request):
theuser.save() theuser.save()
therower = Rower(user=theuser,sex=sex,birthdate=birthdate, therower = Rower(user=theuser,sex=sex,birthdate=birthdate,
weightcategory=weightcategory) weightcategory=weightcategory,
adaptiveclass=adaptiveclass)
therower.save() therower.save()
@@ -3465,6 +3469,7 @@ def addmanual_view(request):
workouttype = form.cleaned_data['workouttype'] workouttype = form.cleaned_data['workouttype']
duration = form.cleaned_data['duration'] duration = form.cleaned_data['duration']
weightcategory = form.cleaned_data['weightcategory'] weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
distance = form.cleaned_data['distance'] distance = form.cleaned_data['distance']
notes = form.cleaned_data['notes'] notes = form.cleaned_data['notes']
thetimezone = form.cleaned_data['timezone'] thetimezone = form.cleaned_data['timezone']
@@ -3514,6 +3519,7 @@ def addmanual_view(request):
distance, distance,
duration,startdatetime, duration,startdatetime,
weightcategory=weightcategory, weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
avghr=avghr, avghr=avghr,
rankingpiece=rankingpiece, rankingpiece=rankingpiece,
avgpwr=avgpwr, avgpwr=avgpwr,
@@ -3533,6 +3539,7 @@ def addmanual_view(request):
w.rankingpiece = rankingpiece w.rankingpiece = rankingpiece
w.privacy = privacy w.privacy = privacy
w.weightcategory = weightcategory w.weightcategory = weightcategory
w.adaptiveclass = adaptiveclass
w.notes = notes w.notes = notes
w.plannedsession = ps w.plannedsession = ps
w.name = name w.name = name
@@ -3650,7 +3657,8 @@ def rankings_view(request,theuser=0,
worldclasspower = int(metrics.getagegrouprecord( worldclasspower = int(metrics.getagegrouprecord(
age, age,
sex=r.sex, sex=r.sex,
weightcategory=r.weightcategory weightcategory=r.weightcategory,
adaptiveclass=r.adaptiveclass,
)) ))
else: else:
worldclasspower = None worldclasspower = None
@@ -10127,6 +10135,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
starttime = form.cleaned_data['starttime'] starttime = form.cleaned_data['starttime']
workouttype = form.cleaned_data['workouttype'] workouttype = form.cleaned_data['workouttype']
weightcategory = form.cleaned_data['weightcategory'] weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
duration = form.cleaned_data['duration'] duration = form.cleaned_data['duration']
distance = form.cleaned_data['distance'] distance = form.cleaned_data['distance']
private = form.cleaned_data['private'] private = form.cleaned_data['private']
@@ -10191,6 +10200,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
row.startdatetime = startdatetime row.startdatetime = startdatetime
row.workouttype = workouttype row.workouttype = workouttype
row.weightcategory = weightcategory row.weightcategory = weightcategory
row.adaptiveclass = adaptiveclass
row.notes = notes row.notes = notes
row.duration = duration row.duration = duration
row.distance = distance row.distance = distance
@@ -13220,6 +13230,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
last_name = ucd['last_name'] last_name = ucd['last_name']
email = ucd['email'] email = ucd['email']
sex = cd['sex'] sex = cd['sex']
adaptiveclass = cd['adaptiveclass']
defaultlandingpage = cd['defaultlandingpage'] defaultlandingpage = cd['defaultlandingpage']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
birthdate = cd['birthdate'] birthdate = cd['birthdate']
@@ -13243,6 +13254,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
u.save() u.save()
r.defaulttimezone=defaulttimezone r.defaulttimezone=defaulttimezone
r.weightcategory = weightcategory r.weightcategory = weightcategory
r.adaptiveclass = adaptiveclass
r.getemailnotifications = getemailnotifications r.getemailnotifications = getemailnotifications
r.getimportantemails = getimportantemails r.getimportantemails = getimportantemails
r.defaultlandingpage = defaultlandingpage r.defaultlandingpage = defaultlandingpage
@@ -13523,6 +13535,7 @@ def rower_prefs_view(request,userid=0,message=""):
sex = cd['sex'] sex = cd['sex']
defaultlandingpage = cd['defaultlandingpage'] defaultlandingpage = cd['defaultlandingpage']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
birthdate = cd['birthdate'] birthdate = cd['birthdate']
showfavoritechartnotes = cd['showfavoritechartnotes'] showfavoritechartnotes = cd['showfavoritechartnotes']
getemailnotifications = cd['getemailnotifications'] getemailnotifications = cd['getemailnotifications']
@@ -13544,6 +13557,7 @@ def rower_prefs_view(request,userid=0,message=""):
u.save() u.save()
r.defaulttimezone=defaulttimezone r.defaulttimezone=defaulttimezone
r.weightcategory = weightcategory r.weightcategory = weightcategory
r.adaptiveclass = adaptiveclass
r.getemailnotifications = getemailnotifications r.getemailnotifications = getemailnotifications
r.getimportantemails = getimportantemails r.getimportantemails = getimportantemails
r.defaultlandingpage = defaultlandingpage r.defaultlandingpage = defaultlandingpage
@@ -15443,7 +15457,7 @@ def plannedsessions_view(request,
totals['time'] = int(totals['time']/60.) totals['time'] = int(totals['time']/60.)
totals['actualtime'] = int(totals['actualtime']/60.) totals['actualtime'] = int(totals['actualtime']/60.)
totals['plannedtime'] = int(totals['plannedtime']/60.) totals['plannedtime'] = int(totals['plannedtime'])
unmatchedworkouts = Workout.objects.filter( unmatchedworkouts = Workout.objects.filter(
user=r, user=r,
@@ -16404,6 +16418,15 @@ def virtualevent_view(request,id=0):
buttons = [] buttons = []
# to-do - add DNS
dns = []
if timezone.now() > race.evaluation_closure:
dns = resultobj.objects.filter(
race=race,
workoutid__isnull=True,
)
if not request.user.is_anonymous(): if not request.user.is_anonymous():
if race_can_register(r,race): if race_can_register(r,race):
buttons += ['registerbutton'] buttons += ['registerbutton']
@@ -16453,6 +16476,11 @@ def virtualevent_view(request,id=0):
except KeyError: except KeyError:
weightcategory = ['hwt','lwt'] weightcategory = ['hwt','lwt']
try:
adaptiveclass = cd['adaptiveclass']
except KeyError:
adaptiveclass = ['None','PR1','PR2','PR3','FES']
if race.sessiontype == 'race': if race.sessiontype == 'race':
results = resultobj.objects.filter( results = resultobj.objects.filter(
race=race, race=race,
@@ -16461,6 +16489,7 @@ def virtualevent_view(request,id=0):
boattype__in=boattype, boattype__in=boattype,
sex__in=sex, sex__in=sex,
weightcategory__in=weightcategory, weightcategory__in=weightcategory,
adaptiveclass__in=adaptiveclass,
age__gte=age_min, age__gte=age_min,
age__lte=age_max age__lte=age_max
).order_by("duration") ).order_by("duration")
@@ -16471,6 +16500,7 @@ def virtualevent_view(request,id=0):
boatclass__in=boatclass, boatclass__in=boatclass,
sex__in=sex, sex__in=sex,
weightcategory__in=weightcategory, weightcategory__in=weightcategory,
adaptiveclass__in=adaptiveclass,
age__gte=age_min, age__gte=age_min,
age__lte=age_max age__lte=age_max
).order_by("duration","-distance") ).order_by("duration","-distance")
@@ -16485,6 +16515,7 @@ def virtualevent_view(request,id=0):
boatclass__in=boatclass, boatclass__in=boatclass,
sex__in=sex, sex__in=sex,
weightcategory__in=weightcategory, weightcategory__in=weightcategory,
adaptiveclass__in=adaptiveclass,
age__gte=age_min, age__gte=age_min,
age__lte=age_max age__lte=age_max
) )
@@ -16500,13 +16531,6 @@ def virtualevent_view(request,id=0):
else: else:
form = None form = None
# to-do - add DNS
dns = []
if timezone.now() > race.evaluation_closure:
dns = resultobj.objects.filter(
race=race,
workoutid__isnull=True,
)
breadcrumbs = [ breadcrumbs = [
@@ -16606,6 +16630,7 @@ def virtualevent_addboat_view(request,id=0):
boattype = cd['boattype'] boattype = cd['boattype']
boatclass = cd['boatclass'] boatclass = cd['boatclass']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
age = cd['age'] age = cd['age']
mix = cd['mix'] mix = cd['mix']
@@ -16650,6 +16675,7 @@ def virtualevent_addboat_view(request,id=0):
l = r.user.last_name l = r.user.last_name
), ),
weightcategory=weightcategory, weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
duration=datetime.time(0,0), duration=datetime.time(0,0),
boattype=boattype, boattype=boattype,
boatclass=boatclass, boatclass=boatclass,
@@ -16680,6 +16706,7 @@ def virtualevent_addboat_view(request,id=0):
initial = { initial = {
'age': calculate_age(r.birthdate), 'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory, 'weightcategory': r.weightcategory,
'adaptiveclass': r.adaptiveclass,
} }
form = VirtualRaceResultForm(initial=initial) form = VirtualRaceResultForm(initial=initial)
@@ -16763,6 +16790,7 @@ def virtualevent_register_view(request,id=0):
boattype = cd['boattype'] boattype = cd['boattype']
boatclass = cd['boatclass'] boatclass = cd['boatclass']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
age = cd['age'] age = cd['age']
mix = cd['mix'] mix = cd['mix']
@@ -16786,6 +16814,7 @@ def virtualevent_register_view(request,id=0):
l = r.user.last_name l = r.user.last_name
), ),
weightcategory=weightcategory, weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
duration=datetime.time(0,0), duration=datetime.time(0,0),
boatclass=boatclass, boatclass=boatclass,
boattype=boattype, boattype=boattype,
@@ -16832,6 +16861,7 @@ def virtualevent_register_view(request,id=0):
initial = { initial = {
'age': calculate_age(r.birthdate), 'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory, 'weightcategory': r.weightcategory,
'adaptiveclass': r.adaptiveclass,
} }
form = VirtualRaceResultForm(initial=initial) form = VirtualRaceResultForm(initial=initial)
@@ -16954,6 +16984,7 @@ def indoorvirtualevent_register_view(request,id=0):
cd = form.cleaned_data cd = form.cleaned_data
teamname = cd['teamname'] teamname = cd['teamname']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
age = cd['age'] age = cd['age']
boatclass = cd['boatclass'] boatclass = cd['boatclass']
@@ -16975,6 +17006,7 @@ def indoorvirtualevent_register_view(request,id=0):
l = r.user.last_name l = r.user.last_name
), ),
weightcategory=weightcategory, weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
duration=datetime.time(0,0), duration=datetime.time(0,0),
boatclass=boatclass, boatclass=boatclass,
coursecompleted=False, coursecompleted=False,
@@ -17020,6 +17052,7 @@ def indoorvirtualevent_register_view(request,id=0):
initial = { initial = {
'age': calculate_age(r.birthdate), 'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory, 'weightcategory': r.weightcategory,
'adaptiveclass': r.adaptiveclass,
} }
form = IndoorVirtualRaceResultForm(initial=initial) form = IndoorVirtualRaceResultForm(initial=initial)