Private
Public Access
1
0

Merge branch 'release/v8.71'

This commit is contained in:
Sander Roosendaal
2018-12-16 12:14:56 +01:00
14 changed files with 240 additions and 39 deletions
+1 -1
View File
@@ -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',
+13 -2
View File
@@ -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,
+3 -1
View File
@@ -149,8 +149,10 @@ def create_c2_stroke_data_db(
totalseconds += duration.second
totalseconds += duration.microsecond/1.e6
try:
spm = 60.*nr_strokes/totalseconds
except ZeroDivisionError:
spm = 20*zeros(nr_strokes)
step = totalseconds/float(nr_strokes)
+26
View File
@@ -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)
@@ -977,6 +990,19 @@ class RaceResultFilterForm(forms.Form):
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',
+33 -4
View File
@@ -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',
+8
View File
@@ -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 = (
+8
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')
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
+1
View File
@@ -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'],
+7
View File
@@ -41,6 +41,13 @@
</a>
</span>
</p>
<p>
<span>
<a href="https://www.pinterest.com/pin/create/button/"
data-pin-do="buttonBookmark">
</a>
</span>
</p>
</li>
<li>
{% if user.is_authenticated and user == rower.user %}
+10 -2
View File
@@ -35,8 +35,7 @@
<a class="fb-xfbml-parse-ignore" target="_blank"
href="https://www.facebook.com/sharer/sharer.php?u={{ request.build_absolute_uri }}">Share</a>
</div>
</p>
<p>
</p><p>
<a class="twitter-share-button"
href="https://twitter.com/intent/tweet"
data-url="{{ request.build_absolute_uri }}"
@@ -45,6 +44,10 @@
{% else %}
data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{ race.name }}'">Tweet</a>
{% endif %}
</p><p>
<a href="https://www.pinterest.com/pin/create/button/"
data-pin-do="buttonBookmark">
</a>
</p>
@@ -241,6 +244,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
{% if race.sessiontype == 'race' %}
<th>Class</th>
<th>Boat</th>
@@ -262,6 +266,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
<td>{{ result.age }}</td>
<td>{{ result.sex }}</td>
<td>{{ result.weightcategory }}</td>
<td>{{ result.adaptiveclass }}</td>
{% if race.sessiontype == 'race' %}
<td>{{ result.boatclass }}</td>
<td>{{ result.boattype }}</td>
@@ -290,6 +295,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
<td>{{ result.age }}</td>
<td>{{ result.sex }}</td>
<td>{{ result.weightcategory }}</td>
<td>{{ result.adaptiveclass }}</td>
{% if race.sessiontype == 'race' %}
<td>{{ result.boatclass }}</td>
<td>{{ result.boattype }}</td>
@@ -341,6 +347,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
<th>Age</th>
<th>Gender</th>
<th>Weight Category</th>
<th>Adaptive</th>
</tr>
<tbody>
{% for record in records %}
@@ -356,6 +363,7 @@ data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{
<td>{{ record.age }}</td>
<td>{{ record.sex }}</td>
<td>{{ record.weightcategory }}</td>
<td>{{ record.adaptiveclass }}</td>
{% if record.userid == rower.id and 'withdrawbutton' in buttons %}
<td>
<a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a>
+63 -2
View File
@@ -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)
@@ -1037,6 +1039,49 @@ boattype: 2x
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):
redis_connection.publish('tasks','KILL')
@@ -1059,7 +1104,6 @@ class EmailTests(TestCase):
subject = filename,
body="""
---
chart: time
workouttype: water
boattype: 4x
...
@@ -1070,12 +1114,27 @@ 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):
try:
os.remove(path)
except IOError:
pass
@patch('requests.get', side_effect=mocked_requests)
def test_emailprocessing(self, mock_get):
@@ -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,
+6 -6
View File
@@ -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:
+44 -10
View File
@@ -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)
+6
View File
@@ -95,6 +95,12 @@
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
</script>
<script
type="text/javascript"
async defer
src="//assets.pinterest.com/js/pinit.js"
>
</script>
<script>
$(document).ready(function(){
var accordionsMenu = $('.cd-accordion-menu');