diff --git a/rowers/admin.py b/rowers/admin.py
index 8b2c0d74..1614ae88 100644
--- a/rowers/admin.py
+++ b/rowers/admin.py
@@ -23,7 +23,7 @@ class RowerInline(admin.StackedInline):
{'fields':('rowerplan','paymenttype','planexpires','teamplanexpires','clubsize','protrialexpires','plantrialexpires',)}),
('Rower Settings',
{'fields':
- ('gdproptin','gdproptindate','weightcategory','sex','birthdate','getemailnotifications',
+ ('gdproptin','gdproptindate','weightcategory','sex','adaptiveclass','birthdate','getemailnotifications',
'getimportantemails','emailbounced','defaultlandingpage',
'defaulttimezone','showfavoritechartnotes')}),
('Rower Zones',
diff --git a/rowers/dataprep.py b/rowers/dataprep.py
index 87029e4a..6b5bae94 100644
--- a/rowers/dataprep.py
+++ b/rowers/dataprep.py
@@ -140,6 +140,7 @@ def workout_summary_to_df(
distances = []
durations = []
weightcategories = []
+ adaptivetypes = []
weightvalues = []
notes = []
tcx_links = []
@@ -155,6 +156,7 @@ def workout_summary_to_df(
distances.append(w.distance)
durations.append(w.duration)
weightcategories.append(w.weightcategory)
+ adaptivetypes.append(w.adaptiveclass)
weightvalues.append(w.weightvalue)
notes.append(w.notes)
tcx_link = SITE_URL+'/rowers/workout/{id}/emailtcx'.format(
@@ -177,6 +179,7 @@ def workout_summary_to_df(
'distance (m)':distances,
'duration ':durations,
'weight category':weightcategories,
+ 'adaptive classification':adaptivetypes,
'weight (kg)':weightvalues,
'notes':notes,
'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,
rankingpiece = False,
duplicate=False,
- title='Manual entry',notes='',weightcategory='hwt'):
+ title='Manual entry',notes='',weightcategory='hwt',
+ adaptiveclass='None'):
if duration is not None:
totalseconds = duration.hour*3600.
@@ -832,6 +836,8 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
dosmooth=False,
workouttype=workouttype,
consistencychecks=False,
+ weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass,
totaltime=totalseconds)
return (id, message)
@@ -841,6 +847,8 @@ from utils import totaltime_sec_to_string
# Processes painsled CSV file to database
def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
boattype='1x',
+ adaptiveclass='None',
+ weightcategory='hwt',
dosummary=True, title='Workout',
workoutsource='unknown',
notes='', totaldist=0, totaltime=0,
@@ -1046,7 +1054,8 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
workouttype=workouttype,
boattype=boattype,
duration=duration, distance=totaldist,
- weightcategory=r.weightcategory,
+ weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass,
starttime=workoutstarttime,
duplicate=duplicate,
workoutsource=workoutsource,
@@ -1328,6 +1337,8 @@ def new_workout_from_file(r, f2,
id, message = save_workout_database(
f2, r,
workouttype=workouttype,
+ weightcategory=r.weightcategory,
+ adaptiveclass=r.adaptiveclass,
boattype=boattype,
makeprivate=makeprivate,
dosummary=dosummary,
diff --git a/rowers/dataprepnodjango.py b/rowers/dataprepnodjango.py
index 92dccaa2..a6e23bf0 100644
--- a/rowers/dataprepnodjango.py
+++ b/rowers/dataprepnodjango.py
@@ -149,9 +149,11 @@ def create_c2_stroke_data_db(
totalseconds += duration.second
totalseconds += duration.microsecond/1.e6
-
- spm = 60.*nr_strokes/totalseconds
-
+ try:
+ spm = 60.*nr_strokes/totalseconds
+ except ZeroDivisionError:
+ spm = 20*zeros(nr_strokes)
+
step = totalseconds/float(nr_strokes)
elapsed = np.arange(nr_strokes)*totalseconds/(float(nr_strokes-1))
diff --git a/rowers/forms.py b/rowers/forms.py
index 05fc77a8..3d7a7070 100644
--- a/rowers/forms.py
+++ b/rowers/forms.py
@@ -575,6 +575,8 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
('lwt','light-weight'),
)
+ adaptivecategories = mytypes.adaptivetypes
+
thisyear = timezone.now().year
birthdate = forms.DateTimeField(
@@ -588,6 +590,7 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
age = (timezone.now() - dob).days/365
if age < 16:
raise forms.ValidationError('Must be at least 16 years old to register')
+ return self.cleaned_data['birthdate']
sex = forms.ChoiceField(required=True,
choices=sexcategories,
@@ -597,6 +600,9 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
weightcategory = forms.ChoiceField(label='Weight Category',
choices=weightcategories)
+ adaptiveclass = forms.ChoiceField(label='Adaptive Classification',
+ choices=adaptivecategories)
+
# def __init__(self, *args, **kwargs):
# self.fields['sex'].initial = 'not specified'
@@ -887,6 +893,7 @@ class RaceResultFilterForm(forms.Form):
('lwt','light-weight'),
)
+ adaptivecategories = mytypes.adaptivetypes
sex = forms.MultipleChoiceField(
choices=sexchoices,
@@ -915,6 +922,12 @@ class RaceResultFilterForm(forms.Form):
initial=['hwt','lwt'],
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):
if 'records' in kwargs:
records = kwargs.pop('records',None)
@@ -976,7 +989,20 @@ class RaceResultFilterForm(forms.Form):
if choice[0] in theweightcategoryes:
weightcategorychoices.append(choice)
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):
# evaluate_after = forms.TimeField(
# input_formats=['%H:%M:%S.%f',
diff --git a/rowers/models.py b/rowers/models.py
index 4b1b0855..e48f252a 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -538,7 +538,7 @@ weightcategories = (
# Extension of User with rowing specific data
class Rower(models.Model):
-
+ adaptivetypes = mytypes.adaptivetypes
stravatypes = (
('Ride','Ride'),
('Kitesurf','Kitesurf'),
@@ -593,6 +593,10 @@ class Rower(models.Model):
max_length=30,
choices=sexcategories)
+ adaptiveclass = models.CharField(choices=adaptivetypes,max_length=50,
+ default='None',
+ verbose_name='Adaptive Classification')
+
birthdate = models.DateField(null=True,blank=True)
# Power Zone Data
ftp = models.IntegerField(default=226,verbose_name="Functional Threshold Power")
@@ -2256,6 +2260,7 @@ class Workout(models.Model):
workouttypes = mytypes.workouttypes
workoutsources = mytypes.workoutsources
privacychoices = mytypes.privacychoices
+ adaptivetypes = mytypes.adaptivetypes
user = models.ForeignKey(Rower)
team = models.ManyToManyField(Team,blank=True)
@@ -2270,6 +2275,9 @@ class Workout(models.Model):
boattype = models.CharField(choices=boattypes,max_length=50,
default='1x',
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)
startdatetime = models.DateTimeField(blank=True,null=True)
timezone = models.CharField(default='UTC',
@@ -2426,6 +2434,9 @@ class VirtualRaceResult(models.Model):
weightcategory = models.CharField(default="hwt",max_length=10,
choices=weightcategories,
verbose_name='Weight Category')
+ adaptiveclass = models.CharField(default="None",max_length=50,
+ choices=mytypes.adaptivetypes,
+ verbose_name="Adaptive Class")
race = models.ForeignKey(VirtualRace)
duration = models.TimeField(default=datetime.time(1,0))
distance = models.IntegerField(default=0)
@@ -2482,6 +2493,9 @@ class IndoorVirtualRaceResult(models.Model):
weightcategory = models.CharField(default="hwt",max_length=10,
choices=weightcategories,
verbose_name='Weight Category')
+ adaptiveclass = models.CharField(default="None",max_length=50,
+ choices=mytypes.adaptivetypes,
+ verbose_name="Adaptive Class")
race = models.ForeignKey(VirtualRace)
duration = models.TimeField(default=datetime.time(1,0))
distance = models.IntegerField(default=0)
@@ -2533,7 +2547,7 @@ class CourseTestResult(models.Model):
class IndoorVirtualRaceResultForm(ModelForm):
class Meta:
model = IndoorVirtualRaceResult
- fields = ['teamname','weightcategory','boatclass','age']
+ fields = ['teamname','weightcategory','boatclass','age','adaptiveclass']
def __init__(self, *args, **kwargs):
@@ -2543,7 +2557,8 @@ class IndoorVirtualRaceResultForm(ModelForm):
class VirtualRaceResultForm(ModelForm):
class Meta:
model = VirtualRaceResult
- fields = ['teamname','weightcategory','boatclass','boattype','age']
+ fields = ['teamname','weightcategory','boatclass','boattype',
+ 'age','adaptiveclass']
def __init__(self, *args, **kwargs):
@@ -2683,7 +2698,20 @@ class WorkoutForm(ModelForm):
# duration = forms.TimeInput(format='%H:%M:%S.%f')
class Meta:
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 = {
'date': AdminDateWidget(),
'notes': forms.Textarea,
@@ -2930,6 +2958,7 @@ class AccountRowerForm(ModelForm):
class Meta:
model = Rower
fields = ['sex','birthdate','weightcategory',
+ 'adaptiveclass',
'getemailnotifications',
'getimportantemails',
'defaulttimezone','showfavoritechartnotes',
diff --git a/rowers/mytypes.py b/rowers/mytypes.py
index ad704756..662481a9 100644
--- a/rowers/mytypes.py
+++ b/rowers/mytypes.py
@@ -283,6 +283,14 @@ boattypes = (
('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]
privacychoices = (
diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py
index 1bf1ab8a..a4056bd1 100644
--- a/rowers/plannedsessions.py
+++ b/rowers/plannedsessions.py
@@ -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')
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
if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime:
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')
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
if ws[0].startdatetime>=startdatetime and ws[0].startdatetime<=enddatetime:
ws[0].plannedsession = race
diff --git a/rowers/serializers.py b/rowers/serializers.py
index 3e94f954..3ecbdd49 100644
--- a/rowers/serializers.py
+++ b/rowers/serializers.py
@@ -79,6 +79,7 @@ class WorkoutSerializer(serializers.ModelSerializer):
duration=validated_data['duration'],
distance=validated_data['distance'],
weightcategory=r.weightcategory,
+ adaptiveclass=r.adaptiveclass,
starttime=validated_data['starttime'],
csvfilename='',
notes=validated_data['notes'],
diff --git a/rowers/templates/show_graph.html b/rowers/templates/show_graph.html
index f4ac2a77..3daeff86 100644
--- a/rowers/templates/show_graph.html
+++ b/rowers/templates/show_graph.html
@@ -41,6 +41,13 @@
+
+
+
+
+
+
{% if user.is_authenticated and user == rower.user %}
diff --git a/rowers/templates/virtualevent.html b/rowers/templates/virtualevent.html
index 5698a83e..71f905c2 100644
--- a/rowers/templates/virtualevent.html
+++ b/rowers/templates/virtualevent.html
@@ -35,16 +35,19 @@
Share
-
-
-
+ data-url="{{ request.build_absolute_uri }}"
+ {% if race.sessiontype == 'race' %}
+ data-text="@rowsandall #rowingdata Participate in virtual race '{{ race.name }}'">Tweet
+ {% else %}
+ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{ race.name }}'">Tweet
{% endif %}
+
+
+
@@ -241,6 +244,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
|
|
|
+ |
{% if race.sessiontype == 'race' %}
Class |
Boat |
@@ -262,6 +266,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
{{ result.age }} |
{{ result.sex }} |
{{ result.weightcategory }} |
+ {{ result.adaptiveclass }} |
{% if race.sessiontype == 'race' %}
{{ result.boatclass }} |
{{ result.boattype }} |
@@ -290,6 +295,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
{{ result.age }} |
{{ result.sex }} |
{{ result.weightcategory }} |
+ {{ result.adaptiveclass }} |
{% if race.sessiontype == 'race' %}
{{ result.boatclass }} |
{{ result.boattype }} |
@@ -341,6 +347,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
Age |
Gender |
Weight Category |
+ Adaptive |
{% for record in records %}
@@ -356,6 +363,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
{{ record.age }} |
{{ record.sex }} |
{{ record.weightcategory }} |
+ {{ record.adaptiveclass }} |
{% if record.userid == rower.id and 'withdrawbutton' in buttons %}
Withdraw
diff --git a/rowers/tests.py b/rowers/tests.py
index 1171ada4..9aff5550 100644
--- a/rowers/tests.py
+++ b/rowers/tests.py
@@ -459,7 +459,8 @@ class C2Objects(DjangoTestCase):
self.assertEqual(response.status_code, 302)
@patch('rowers.c2stuff.requests.post', side_effect=mocked_requests)
- def test_c2_list(self, mock_get):
+ @patch('rowers.c2stuff.requests.get', side_effect=mocked_requests)
+ def test_c2_list(self, mock_get, mock_post):
response = self.c.get('/rowers/workout/c2list',follow=True)
self.assertEqual(response.status_code,200)
@@ -968,6 +969,7 @@ class NewUserRegistrationTest(TestCase):
'password2':'aapindewei2',
'tos':True,
'weightcategory':'hwt',
+ 'adaptiveclass': 'None',
'sex':'male',
'next':'/rowers/list-workouts',
'birthdate':datetime.datetime(year=1970,month=4,day=2)
@@ -1036,6 +1038,49 @@ boattype: 2x
out = StringIO()
call_command('processemail', stdout=out, testing=True)
self.assertIn('Successfully processed email attachments',out.getvalue())
+
+class UploadTests(TestCase):
+ def setUp(self):
+ redis_connection.publish('tasks','KILL')
+ u = User.objects.create_user('john',
+ 'sander@ds.ds',
+ 'koeinsloot')
+ r = Rower.objects.create(user=u,gdproptin=True,
+ gdproptindate=timezone.now()
+ )
+
+ nu = datetime.datetime.now()
+ workoutsbox = Mailbox.objects.create(name='workouts')
+ workoutsbox.save()
+ failbox = Mailbox.objects.create(name='Failed')
+ failbox.save()
+ m = Message(mailbox=workoutsbox,
+ from_header = u.email,
+ subject = "3x(5min/2min)/r2 \r2",
+ body = """
+workout run
+ """)
+ m.save()
+ a2 = 'media/mailbox_attachments/colin2.csv'
+ copyfile('rowers/testdata/emails/colin.csv',a2)
+ a = MessageAttachment(message=m,document=a2[6:])
+ a.save()
+
+ def tearDown(self):
+ for filename in os.listdir('media/mailbox_attachments'):
+ path = os.path.join('media/mailbox_attachments/',filename)
+ if not os.path.isdir(path):
+ try:
+ os.remove(path)
+ except IOError:
+ pass
+
+ @patch('requests.get', side_effect=mocked_requests)
+ def test_email_workouttype(self, mock_get):
+ out = StringIO()
+ call_command('processemail', stdout=out, testing=True)
+ w = Workout.objects.get(id=1)
+ self.assertEqual(w.workouttype,'Run')
class EmailTests(TestCase):
def setUp(self):
@@ -1059,7 +1104,6 @@ class EmailTests(TestCase):
subject = filename,
body="""
---
-chart: time
workouttype: water
boattype: 4x
...
@@ -1070,13 +1114,28 @@ boattype: 4x
a = MessageAttachment(message=m,document=a2[6:])
a.save()
+ m = Message(mailbox=workoutsbox,
+ from_header = u.email,
+ subject = "3x(5min/2min)/r2 \r2",
+ body = """
+workout water
+ """)
+ m.save()
+ a2 = 'media/mailbox_attachments/colin2.csv'
+ copyfile('rowers/testdata/emails/colin.csv',a2)
+ a = MessageAttachment(message=m,document=a2[6:])
+ a.save()
+
def tearDown(self):
for filename in os.listdir('media/mailbox_attachments'):
path = os.path.join('media/mailbox_attachments/',filename)
if not os.path.isdir(path):
- os.remove(path)
-
+ try:
+ os.remove(path)
+ except IOError:
+ pass
+
@patch('requests.get', side_effect=mocked_requests)
def test_emailprocessing(self, mock_get):
out = StringIO()
@@ -1145,6 +1204,7 @@ class DataTest(TestCase):
'distance':8000,
'notes':'Aap noot \n mies',
'weightcategory':'lwt',
+ 'adaptiveclass': 'PR1',
'workouttype':'water',
'boattype':'1x',
'private':False,
@@ -1376,6 +1436,7 @@ class ViewTest(TestCase):
'duration':'1:00:00.5',
'distance':'15000',
'weightcategory':'hwt',
+ 'adaptiveclass':'PR1',
'workouttype':'rower',
'boattype':'1x',
'private':True,
diff --git a/rowers/uploads.py b/rowers/uploads.py
index ac60340c..b040c56a 100644
--- a/rowers/uploads.py
+++ b/rowers/uploads.py
@@ -127,7 +127,7 @@ def gettypeoptions_body2(uploadoptions,body):
if tester.match(line.lower()):
for typ,verb in workouttypes:
str1 = '^(workout)(.*)({a})'.format(
- a = typ
+ a = typ.lower()
)
testert = re.compile(str1)
if testert.match(line.lower()):
@@ -239,11 +239,11 @@ def getplotoptions(uploadoptions,value):
def gettype(uploadoptions,value,key):
workouttype = 'rower'
- for type,verb in workouttypes:
- if value == type:
- workouttype = type
+ for typ,verb in workouttypes:
+ if value == typ:
+ workouttype = typ
if value == verb:
- workouttype = type
+ workouttype = typ
uploadoptions[key] = workouttype
@@ -314,7 +314,7 @@ def upload_options(body):
uploadoptions = getplotoptions_body2(uploadoptions,body)
uploadoptions = getsyncoptions_body2(uploadoptions,body)
uploadoptions = getprivateoptions_body2(uploadoptions,body)
- typeoptions = gettypeoptions_body2(uploadoptions,body)
+ uploadoptions = gettypeoptions_body2(uploadoptions,body)
uploadoptions = getstravaid(uploadoptions,body)
uploadoptions = getworkoutsources(uploadoptions,body)
except IOError:
diff --git a/rowers/views.py b/rowers/views.py
index 8a32085c..c7b4d897 100644
--- a/rowers/views.py
+++ b/rowers/views.py
@@ -1032,6 +1032,8 @@ def add_defaultfavorites(r):
def rower_register_view(request):
nextpage = request.GET.get('next','/rowers/list-workouts/')
+ if nextpage == '':
+ nextpage = '/rowers/list-workouts/'
if request.method == 'POST':
#form = RegistrationFormUniqueEmail(request.POST)
@@ -1045,6 +1047,7 @@ def rower_register_view(request):
sex = form.cleaned_data['sex']
birthdate = form.cleaned_data['birthdate']
weightcategory = form.cleaned_data['weightcategory']
+ adaptiveclass = form.cleaned_data['adaptiveclass']
nextpage = request.POST['next']
theuser = User.objects.create_user(username,password=password)
theuser.first_name = first_name
@@ -1053,7 +1056,8 @@ def rower_register_view(request):
theuser.save()
therower = Rower(user=theuser,sex=sex,birthdate=birthdate,
- weightcategory=weightcategory)
+ weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass)
therower.save()
@@ -3382,6 +3386,7 @@ def addmanual_view(request):
workouttype = form.cleaned_data['workouttype']
duration = form.cleaned_data['duration']
weightcategory = form.cleaned_data['weightcategory']
+ adaptiveclass = form.cleaned_data['adaptiveclass']
distance = form.cleaned_data['distance']
notes = form.cleaned_data['notes']
thetimezone = form.cleaned_data['timezone']
@@ -3431,6 +3436,7 @@ def addmanual_view(request):
distance,
duration,startdatetime,
weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass,
avghr=avghr,
rankingpiece=rankingpiece,
avgpwr=avgpwr,
@@ -3450,6 +3456,7 @@ def addmanual_view(request):
w.rankingpiece = rankingpiece
w.privacy = privacy
w.weightcategory = weightcategory
+ w.adaptiveclass = adaptiveclass
w.notes = notes
w.plannedsession = ps
w.name = name
@@ -3567,7 +3574,8 @@ def rankings_view(request,theuser=0,
worldclasspower = int(metrics.getagegrouprecord(
age,
sex=r.sex,
- weightcategory=r.weightcategory
+ weightcategory=r.weightcategory,
+ adaptiveclass=r.adaptiveclass,
))
else:
worldclasspower = None
@@ -10044,6 +10052,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
starttime = form.cleaned_data['starttime']
workouttype = form.cleaned_data['workouttype']
weightcategory = form.cleaned_data['weightcategory']
+ adaptiveclass = form.cleaned_data['adaptiveclass']
duration = form.cleaned_data['duration']
distance = form.cleaned_data['distance']
private = form.cleaned_data['private']
@@ -10108,6 +10117,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
row.startdatetime = startdatetime
row.workouttype = workouttype
row.weightcategory = weightcategory
+ row.adaptiveclass = adaptiveclass
row.notes = notes
row.duration = duration
row.distance = distance
@@ -13137,6 +13147,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
last_name = ucd['last_name']
email = ucd['email']
sex = cd['sex']
+ adaptiveclass = cd['adaptiveclass']
defaultlandingpage = cd['defaultlandingpage']
weightcategory = cd['weightcategory']
birthdate = cd['birthdate']
@@ -13160,6 +13171,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
u.save()
r.defaulttimezone=defaulttimezone
r.weightcategory = weightcategory
+ r.adaptiveclass = adaptiveclass
r.getemailnotifications = getemailnotifications
r.getimportantemails = getimportantemails
r.defaultlandingpage = defaultlandingpage
@@ -13440,6 +13452,7 @@ def rower_prefs_view(request,userid=0,message=""):
sex = cd['sex']
defaultlandingpage = cd['defaultlandingpage']
weightcategory = cd['weightcategory']
+ adaptiveclass = cd['adaptiveclass']
birthdate = cd['birthdate']
showfavoritechartnotes = cd['showfavoritechartnotes']
getemailnotifications = cd['getemailnotifications']
@@ -13461,6 +13474,7 @@ def rower_prefs_view(request,userid=0,message=""):
u.save()
r.defaulttimezone=defaulttimezone
r.weightcategory = weightcategory
+ r.adaptiveclass = adaptiveclass
r.getemailnotifications = getemailnotifications
r.getimportantemails = getimportantemails
r.defaultlandingpage = defaultlandingpage
@@ -15153,6 +15167,7 @@ def plannedsession_teamedit_view(request,
#@user_passes_test(iscoachmember,login_url="/rowers/promembership/",
# redirect_field_name=None)
+@login_required()
def plannedsessions_coach_view(request,
teamid=0,userid=0):
@@ -15360,7 +15375,7 @@ def plannedsessions_view(request,
totals['time'] = int(totals['time']/60.)
totals['actualtime'] = int(totals['actualtime']/60.)
- totals['plannedtime'] = int(totals['plannedtime']/60.)
+ totals['plannedtime'] = int(totals['plannedtime'])
unmatchedworkouts = Workout.objects.filter(
user=r,
@@ -16321,6 +16336,15 @@ def virtualevent_view(request,id=0):
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 race_can_register(r,race):
buttons += ['registerbutton']
@@ -16370,6 +16394,11 @@ def virtualevent_view(request,id=0):
except KeyError:
weightcategory = ['hwt','lwt']
+ try:
+ adaptiveclass = cd['adaptiveclass']
+ except KeyError:
+ adaptiveclass = ['None','PR1','PR2','PR3','FES']
+
if race.sessiontype == 'race':
results = resultobj.objects.filter(
race=race,
@@ -16378,6 +16407,7 @@ def virtualevent_view(request,id=0):
boattype__in=boattype,
sex__in=sex,
weightcategory__in=weightcategory,
+ adaptiveclass__in=adaptiveclass,
age__gte=age_min,
age__lte=age_max
).order_by("duration")
@@ -16388,6 +16418,7 @@ def virtualevent_view(request,id=0):
boatclass__in=boatclass,
sex__in=sex,
weightcategory__in=weightcategory,
+ adaptiveclass__in=adaptiveclass,
age__gte=age_min,
age__lte=age_max
).order_by("duration","-distance")
@@ -16402,6 +16433,7 @@ def virtualevent_view(request,id=0):
boatclass__in=boatclass,
sex__in=sex,
weightcategory__in=weightcategory,
+ adaptiveclass__in=adaptiveclass,
age__gte=age_min,
age__lte=age_max
)
@@ -16417,13 +16449,6 @@ def virtualevent_view(request,id=0):
else:
form = None
- # to-do - add DNS
- dns = []
- if timezone.now() > race.evaluation_closure:
- dns = resultobj.objects.filter(
- race=race,
- workoutid__isnull=True,
- )
breadcrumbs = [
@@ -16523,6 +16548,7 @@ def virtualevent_addboat_view(request,id=0):
boattype = cd['boattype']
boatclass = cd['boatclass']
weightcategory = cd['weightcategory']
+ adaptiveclass = cd['adaptiveclass']
age = cd['age']
mix = cd['mix']
@@ -16567,6 +16593,7 @@ def virtualevent_addboat_view(request,id=0):
l = r.user.last_name
),
weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass,
duration=datetime.time(0,0),
boattype=boattype,
boatclass=boatclass,
@@ -16597,6 +16624,7 @@ def virtualevent_addboat_view(request,id=0):
initial = {
'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory,
+ 'adaptiveclass': r.adaptiveclass,
}
form = VirtualRaceResultForm(initial=initial)
@@ -16680,6 +16708,7 @@ def virtualevent_register_view(request,id=0):
boattype = cd['boattype']
boatclass = cd['boatclass']
weightcategory = cd['weightcategory']
+ adaptiveclass = cd['adaptiveclass']
age = cd['age']
mix = cd['mix']
@@ -16703,6 +16732,7 @@ def virtualevent_register_view(request,id=0):
l = r.user.last_name
),
weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass,
duration=datetime.time(0,0),
boatclass=boatclass,
boattype=boattype,
@@ -16749,6 +16779,7 @@ def virtualevent_register_view(request,id=0):
initial = {
'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory,
+ 'adaptiveclass': r.adaptiveclass,
}
form = VirtualRaceResultForm(initial=initial)
@@ -16871,6 +16902,7 @@ def indoorvirtualevent_register_view(request,id=0):
cd = form.cleaned_data
teamname = cd['teamname']
weightcategory = cd['weightcategory']
+ adaptiveclass = cd['adaptiveclass']
age = cd['age']
boatclass = cd['boatclass']
@@ -16892,6 +16924,7 @@ def indoorvirtualevent_register_view(request,id=0):
l = r.user.last_name
),
weightcategory=weightcategory,
+ adaptiveclass=adaptiveclass,
duration=datetime.time(0,0),
boatclass=boatclass,
coursecompleted=False,
@@ -16937,6 +16970,7 @@ def indoorvirtualevent_register_view(request,id=0):
initial = {
'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory,
+ 'adaptiveclass': r.adaptiveclass,
}
form = IndoorVirtualRaceResultForm(initial=initial)
diff --git a/templates/newbase.html b/templates/newbase.html
index 755e5667..00ddebf6 100644
--- a/templates/newbase.html
+++ b/templates/newbase.html
@@ -95,6 +95,12 @@
+
|