rewind to world before StandardTimes
This commit is contained in:
@@ -12,7 +12,7 @@ from .models import (
|
|||||||
WorkoutComment,C2WorldClassAgePerformance,PlannedSession,
|
WorkoutComment,C2WorldClassAgePerformance,PlannedSession,
|
||||||
GeoCourse,GeoPolygon,GeoPoint,VirtualRace,VirtualRaceResult,
|
GeoCourse,GeoPolygon,GeoPoint,VirtualRace,VirtualRaceResult,
|
||||||
PaidPlan,IndoorVirtualRaceResult,ShareKey,
|
PaidPlan,IndoorVirtualRaceResult,ShareKey,
|
||||||
CourseStandard,StandardCollection,
|
# CourseStandard,StandardCollection,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Register your models here so you can use them in the Admin module
|
# Register your models here so you can use them in the Admin module
|
||||||
@@ -142,11 +142,11 @@ class IndoorVirtualRaceResultAdmin(admin.ModelAdmin):
|
|||||||
class PaidPlanAdmin(admin.ModelAdmin):
|
class PaidPlanAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name','shortname','price','paymenttype','paymentprocessor','external_id')
|
list_display = ('name','shortname','price','paymenttype','paymentprocessor','external_id')
|
||||||
|
|
||||||
class StandardCollectionAdmin(admin.ModelAdmin):
|
#class StandardCollectionAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name','manager')
|
# list_display = ('name','manager')
|
||||||
|
|
||||||
class CourseStandardAdmin(admin.ModelAdmin):
|
#class CourseStandardAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name','standardcollection')
|
# list_display = ('name','standardcollection')
|
||||||
|
|
||||||
admin.site.unregister(User)
|
admin.site.unregister(User)
|
||||||
admin.site.register(User,UserAdmin)
|
admin.site.register(User,UserAdmin)
|
||||||
@@ -167,5 +167,5 @@ admin.site.register(VirtualRaceResult, VirtualRaceResultAdmin)
|
|||||||
admin.site.register(IndoorVirtualRaceResult, IndoorVirtualRaceResultAdmin)
|
admin.site.register(IndoorVirtualRaceResult, IndoorVirtualRaceResultAdmin)
|
||||||
admin.site.register(PaidPlan,PaidPlanAdmin)
|
admin.site.register(PaidPlan,PaidPlanAdmin)
|
||||||
admin.site.register(ShareKey,ShareKeyAdmin)
|
admin.site.register(ShareKey,ShareKeyAdmin)
|
||||||
admin.site.register(CourseStandard,CourseStandardAdmin)
|
#admin.site.register(CourseStandard,CourseStandardAdmin)
|
||||||
admin.site.register(StandardCollection,StandardCollectionAdmin)
|
#admin.site.register(StandardCollection,StandardCollectionAdmin)
|
||||||
|
|||||||
@@ -212,18 +212,18 @@ class CourseForm(forms.Form):
|
|||||||
from django.forms.widgets import HiddenInput
|
from django.forms.widgets import HiddenInput
|
||||||
super(CourseForm, self).__init__(*args, **kwargs)
|
super(CourseForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# The form used for uploading images
|
# The form used for uploading files
|
||||||
class StandardsForm(forms.Form):
|
#class StandardsForm(forms.Form):
|
||||||
name = forms.CharField(max_length=150,label='Course Name')
|
# name = forms.CharField(max_length=150,label='Course Name')
|
||||||
file = forms.FileField(required=False,
|
# file = forms.FileField(required=False,
|
||||||
validators=[must_be_csv])
|
# validators=[must_be_csv])
|
||||||
notes = forms.CharField(required=False,
|
# notes = forms.CharField(required=False,
|
||||||
max_length=200,label='Course Notes',
|
# max_length=200,label='Course Notes',
|
||||||
widget=forms.Textarea)
|
# widget=forms.Textarea)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
# def __init__(self, *args, **kwargs):
|
||||||
from django.forms.widgets import HiddenInput
|
# from django.forms.widgets import HiddenInput
|
||||||
super(StandardsForm, self).__init__(*args, **kwargs)
|
# super(StandardsForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# The form used for uploading files
|
# The form used for uploading files
|
||||||
class DocumentsForm(forms.Form):
|
class DocumentsForm(forms.Form):
|
||||||
@@ -1230,11 +1230,11 @@ class RaceResultFilterForm(forms.Form):
|
|||||||
initial=['None','PR1','PR2','PR3','FES'],
|
initial=['None','PR1','PR2','PR3','FES'],
|
||||||
widget=forms.CheckboxSelectMultiple())
|
widget=forms.CheckboxSelectMultiple())
|
||||||
|
|
||||||
entrycategory = forms.MultipleChoiceField(
|
# entrycategory = forms.MultipleChoiceField(
|
||||||
choices = [],
|
# choices = [],
|
||||||
label = 'Groups',
|
# label = 'Groups',
|
||||||
widget=forms.CheckboxSelectMultiple()
|
# widget=forms.CheckboxSelectMultiple()
|
||||||
)
|
# )
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if 'records' in kwargs:
|
if 'records' in kwargs:
|
||||||
@@ -1244,19 +1244,18 @@ class RaceResultFilterForm(forms.Form):
|
|||||||
|
|
||||||
if records:
|
if records:
|
||||||
# group
|
# group
|
||||||
thecategories = [record.entrycategory for record in records]
|
# thecategories = [record.entrycategory for record in records]
|
||||||
thecategories = list(set(thecategories))
|
# thecategories = list(set(thecategories))
|
||||||
if len(thecategories) <= 1:
|
# if len(thecategories) <= 1:
|
||||||
del self.fields['entrycategory']
|
# del self.fields['entrycategory']
|
||||||
else:
|
# else:
|
||||||
categorychoices = []
|
# categorychoices = []
|
||||||
for category in thecategories:
|
# for category in thecategories:
|
||||||
if category is not None:
|
## categorychoices.append(
|
||||||
categorychoices.append(
|
# (category.id,category)
|
||||||
(category.id,category)
|
# )
|
||||||
)
|
# self.fields['entrycategory'].choices = categorychoices
|
||||||
self.fields['entrycategory'].choices = categorychoices
|
# self.fields['entrycategory'].initial = [cat[0] for cat in categorychoices]
|
||||||
self.fields['entrycategory'].initial = [cat[0] for cat in categorychoices]
|
|
||||||
|
|
||||||
# sex
|
# sex
|
||||||
thesexes = [record.sex for record in records]
|
thesexes = [record.sex for record in records]
|
||||||
|
|||||||
140
rowers/models.py
140
rowers/models.py
@@ -2183,38 +2183,38 @@ class PlannedSession(models.Model):
|
|||||||
|
|
||||||
from django.core.validators import RegexValidator,validate_email
|
from django.core.validators import RegexValidator,validate_email
|
||||||
|
|
||||||
class StandardCollection(models.Model):
|
#class StandardCollection(models.Model):
|
||||||
name = models.CharField(max_length=150)
|
# name = models.CharField(max_length=150)
|
||||||
manager = models.ForeignKey(User, null=True,on_delete=models.CASCADE)
|
# manager = models.ForeignKey(User, null=True,on_delete=models.CASCADE)
|
||||||
notes = models.CharField(blank=True,null=True,max_length=1000)
|
# notes = models.CharField(blank=True,null=True,max_length=1000)
|
||||||
active = models.BooleanField(default=True)
|
# active = models.BooleanField(default=True)
|
||||||
|
|
||||||
def __str__(self):
|
# def __str__(self):
|
||||||
return self.name
|
# return self.name
|
||||||
|
|
||||||
class CourseStandard(models.Model):
|
#class CourseStandard(models.Model):
|
||||||
name = models.CharField(max_length=150)
|
# name = models.CharField(max_length=150)
|
||||||
coursedistance = models.IntegerField()
|
# coursedistance = models.IntegerField()
|
||||||
coursetime = models.CharField(max_length=100,default="")
|
# coursetime = models.CharField(max_length=100,default="")
|
||||||
referencespeed = models.FloatField() # average boat speed
|
# referencespeed = models.FloatField() # average boat speed
|
||||||
agemin = models.IntegerField(default=0)
|
# agemin = models.IntegerField(default=0)
|
||||||
agemax = models.IntegerField(default=120)
|
# agemax = models.IntegerField(default=120)
|
||||||
boatclass = models.CharField(max_length=150) # corresponds to workout workouttype
|
# boatclass = models.CharField(max_length=150) # corresponds to workout workouttype
|
||||||
boattype = models.CharField(choices=mytypes.boattypes,max_length=50,default='1x')
|
# boattype = models.CharField(choices=mytypes.boattypes,max_length=50,default='1x')
|
||||||
sex = models.CharField(max_length=150)
|
# sex = models.CharField(max_length=150)
|
||||||
weightclass = models.CharField(max_length=150)
|
# weightclass = models.CharField(max_length=150)
|
||||||
adaptiveclass = models.CharField(choices=mytypes.adaptivetypes,max_length=50,default="None")
|
# adaptiveclass = models.CharField(choices=mytypes.adaptivetypes,max_length=50,default="None")
|
||||||
skillclass = models.CharField(max_length=150)
|
# skillclass = models.CharField(max_length=150)
|
||||||
standardcollection = models.ForeignKey(StandardCollection,on_delete=models.CASCADE)
|
# standardcollection = models.ForeignKey(StandardCollection,on_delete=models.CASCADE)
|
||||||
|
|
||||||
class Meta:
|
# class Meta:
|
||||||
unique_together = (
|
# unique_together = (
|
||||||
('name','standardcollection')
|
# ('name','standardcollection')
|
||||||
)
|
# )
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
# def __str__(self):
|
||||||
return self.name
|
# return self.name
|
||||||
|
|
||||||
registerchoices = (
|
registerchoices = (
|
||||||
('windowstart','Start of challenge Window'),
|
('windowstart','Start of challenge Window'),
|
||||||
@@ -2253,8 +2253,8 @@ class VirtualRace(PlannedSession):
|
|||||||
contact_email = models.EmailField(max_length=254,
|
contact_email = models.EmailField(max_length=254,
|
||||||
validators=[validate_email],blank=True)
|
validators=[validate_email],blank=True)
|
||||||
|
|
||||||
coursestandards = models.ForeignKey(StandardCollection,null=True,on_delete=models.SET_NULL,
|
# coursestandards = models.ForeignKey(StandardCollection,null=True,on_delete=models.SET_NULL,
|
||||||
verbose_name='Standard Times',blank=True)
|
# verbose_name='Standard Times',blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
||||||
@@ -2424,7 +2424,7 @@ class IndoorVirtualRaceForm(ModelForm):
|
|||||||
'registration_closure',
|
'registration_closure',
|
||||||
'evaluation_closure',
|
'evaluation_closure',
|
||||||
'comment',
|
'comment',
|
||||||
'coursestandards',
|
# 'coursestandards',
|
||||||
'contact_phone',
|
'contact_phone',
|
||||||
'contact_email',
|
'contact_email',
|
||||||
]
|
]
|
||||||
@@ -2458,7 +2458,7 @@ class IndoorVirtualRaceForm(ModelForm):
|
|||||||
self.fields['sessionunit'].initial = 'm'
|
self.fields['sessionunit'].initial = 'm'
|
||||||
if timezone:
|
if timezone:
|
||||||
self.fields['timezone'].initial = timezone
|
self.fields['timezone'].initial = timezone
|
||||||
self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
|
# self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cd = self.cleaned_data
|
cd = self.cleaned_data
|
||||||
@@ -2562,7 +2562,7 @@ class VirtualRaceForm(ModelForm):
|
|||||||
'registration_closure',
|
'registration_closure',
|
||||||
'evaluation_closure',
|
'evaluation_closure',
|
||||||
'course',
|
'course',
|
||||||
'coursestandards',
|
# 'coursestandards',
|
||||||
'comment',
|
'comment',
|
||||||
'contact_phone',
|
'contact_phone',
|
||||||
'contact_email',
|
'contact_email',
|
||||||
@@ -2586,7 +2586,7 @@ class VirtualRaceForm(ModelForm):
|
|||||||
def __init__(self,*args,**kwargs):
|
def __init__(self,*args,**kwargs):
|
||||||
super(VirtualRaceForm, self).__init__(*args, **kwargs)
|
super(VirtualRaceForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
|
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
|
||||||
self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
|
# self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
|
||||||
|
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
@@ -2932,12 +2932,12 @@ class VirtualRaceResult(models.Model):
|
|||||||
adaptiveclass = models.CharField(default="None",max_length=50,
|
adaptiveclass = models.CharField(default="None",max_length=50,
|
||||||
choices=mytypes.adaptivetypes,
|
choices=mytypes.adaptivetypes,
|
||||||
verbose_name="Adaptive Class")
|
verbose_name="Adaptive Class")
|
||||||
skillclass = models.CharField(default="Open",max_length=50,
|
# skillclass = models.CharField(default="Open",max_length=50,
|
||||||
verbose_name="Skill Class")
|
# verbose_name="Skill Class")
|
||||||
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
|
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
|
||||||
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)
|
||||||
points = models.IntegerField(default=0)
|
# points = models.IntegerField(default=0)
|
||||||
boatclass = models.CharField(choices=boatclasses,
|
boatclass = models.CharField(choices=boatclasses,
|
||||||
max_length=40,
|
max_length=40,
|
||||||
default='water',
|
default='water',
|
||||||
@@ -2958,9 +2958,9 @@ class VirtualRaceResult(models.Model):
|
|||||||
|
|
||||||
startsecond = models.FloatField(default=0)
|
startsecond = models.FloatField(default=0)
|
||||||
endsecond = models.FloatField(default=0)
|
endsecond = models.FloatField(default=0)
|
||||||
referencespeed = models.FloatField(default=5.0)
|
# referencespeed = models.FloatField(default=5.0)
|
||||||
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
# entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
||||||
verbose_name='Group')
|
# verbose_name='Group')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
@@ -2969,13 +2969,13 @@ class VirtualRaceResult(models.Model):
|
|||||||
u2 = rr.user.last_name,
|
u2 = rr.user.last_name,
|
||||||
)
|
)
|
||||||
if self.teamname:
|
if self.teamname:
|
||||||
if self.entrycategory:
|
# if self.entrycategory:
|
||||||
return u'Entry for {n} for "{r}" in {g} with {t}'.format(
|
# return u'Entry for {n} for "{r}" in {g} with {t}'.format(
|
||||||
n = name,
|
# n = name,
|
||||||
r = self.race,
|
# r = self.race,
|
||||||
g = self.entrycategory,
|
# g = self.entrycategory,
|
||||||
t = self.teamname,
|
# t = self.teamname,
|
||||||
)
|
# )
|
||||||
|
|
||||||
return u'Entry for {n} for "{r}" in {c} {d} with {t} ({s})'.format(
|
return u'Entry for {n} for "{r}" in {c} {d} with {t} ({s})'.format(
|
||||||
n = name,
|
n = name,
|
||||||
@@ -3015,13 +3015,13 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
adaptiveclass = models.CharField(default="None",max_length=50,
|
adaptiveclass = models.CharField(default="None",max_length=50,
|
||||||
choices=mytypes.adaptivetypes,
|
choices=mytypes.adaptivetypes,
|
||||||
verbose_name="Adaptive Class")
|
verbose_name="Adaptive Class")
|
||||||
skillclass = models.CharField(default="Open",max_length=50,
|
# skillclass = models.CharField(default="Open",max_length=50,
|
||||||
verbose_name="Skill Class")
|
# verbose_name="Skill Class")
|
||||||
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
|
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
|
||||||
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)
|
||||||
referencespeed = models.FloatField(default=5.0)
|
referencespeed = models.FloatField(default=5.0)
|
||||||
points = models.IntegerField(default=0)
|
# points = models.IntegerField(default=0)
|
||||||
boatclass = models.CharField(choices=boatclasses,
|
boatclass = models.CharField(choices=boatclasses,
|
||||||
max_length=40,
|
max_length=40,
|
||||||
default='rower',
|
default='rower',
|
||||||
@@ -3035,8 +3035,8 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
age = models.IntegerField(null=True)
|
age = models.IntegerField(null=True)
|
||||||
emailnotifications = models.BooleanField(default=True,
|
emailnotifications = models.BooleanField(default=True,
|
||||||
verbose_name = 'Receive challenge notifications by email')
|
verbose_name = 'Receive challenge notifications by email')
|
||||||
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
# entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
||||||
verbose_name='Group')
|
# verbose_name='Group')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
@@ -3045,13 +3045,13 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
u2 = rr.user.last_name,
|
u2 = rr.user.last_name,
|
||||||
)
|
)
|
||||||
if self.teamname:
|
if self.teamname:
|
||||||
if self.entrycategory:
|
# if self.entrycategory:
|
||||||
return u'Entry for {n} for "{r}" in {g} with {t}'.format(
|
# return u'Entry for {n} for "{r}" in {g} with {t}'.format(
|
||||||
n = name,
|
# n = name,
|
||||||
r = self.race,
|
# r = self.race,
|
||||||
g = self.entrycategory,
|
# g = self.entrycategory,
|
||||||
t = self.teamname,
|
# t = self.teamname,
|
||||||
)
|
# )
|
||||||
return u'Entry for {n} for "{r}" on {c} with {t} ({s})'.format(
|
return u'Entry for {n} for "{r}" on {c} with {t} ({s})'.format(
|
||||||
n = name,
|
n = name,
|
||||||
r = self.race,
|
r = self.race,
|
||||||
@@ -3091,13 +3091,13 @@ class IndoorVirtualRaceResultForm(ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
categories = kwargs.pop('categories',None)
|
# categories = kwargs.pop('categories',None)
|
||||||
super(IndoorVirtualRaceResultForm, self).__init__(*args, **kwargs)
|
super(IndoorVirtualRaceResultForm, self).__init__(*args, **kwargs)
|
||||||
if categories is not None:
|
# if categories is not None:
|
||||||
self.fields['entrycategory'].queryset = categories
|
# self.fields['entrycategory'].queryset = categories
|
||||||
self.fields['entrycategory'].empty_label = None
|
# self.fields['entrycategory'].empty_label = None
|
||||||
else:
|
# else:
|
||||||
self.fields.pop('entrycategory')
|
# self.fields.pop('entrycategory')
|
||||||
|
|
||||||
class VirtualRaceResultForm(ModelForm):
|
class VirtualRaceResultForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -3110,7 +3110,7 @@ class VirtualRaceResultForm(ModelForm):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
boattypes = kwargs.pop('boattypes',None)
|
boattypes = kwargs.pop('boattypes',None)
|
||||||
categories = kwargs.pop('categories',None)
|
# categories = kwargs.pop('categories',None)
|
||||||
super(VirtualRaceResultForm, self).__init__(*args, **kwargs)
|
super(VirtualRaceResultForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
if boattypes:
|
if boattypes:
|
||||||
@@ -3120,11 +3120,11 @@ class VirtualRaceResultForm(ModelForm):
|
|||||||
required=False,
|
required=False,
|
||||||
label='Mixed Gender')
|
label='Mixed Gender')
|
||||||
|
|
||||||
if categories is not None:
|
# if categories is not None:
|
||||||
self.fields['entrycategory'].queryset = categories
|
# self.fields['entrycategory'].queryset = categories
|
||||||
self.fields['entrycategory'].empty_label = None
|
# self.fields['entrycategory'].empty_label = None
|
||||||
else:
|
# else:
|
||||||
self.fields.pop('entrycategory')
|
# self.fields.pop('entrycategory')
|
||||||
|
|
||||||
from rowers.metrics import rowingmetrics
|
from rowers.metrics import rowingmetrics
|
||||||
|
|
||||||
|
|||||||
@@ -1514,7 +1514,6 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
|
|||||||
return 0,comments,errors,0
|
return 0,comments,errors,0
|
||||||
|
|
||||||
if ws[0].workouttype != record.boatclass:
|
if ws[0].workouttype != record.boatclass:
|
||||||
print(ws[0].workouttype,record.boatclass)
|
|
||||||
errors.append('Your workout boat class is different than on your race registration')
|
errors.append('Your workout boat class is different than on your race registration')
|
||||||
return 0,comments,errors,0
|
return 0,comments,errors,0
|
||||||
|
|
||||||
@@ -1553,7 +1552,8 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
|
|||||||
|
|
||||||
job = myqueue(queue,handle_check_race_course,ws[0].csvfilename,
|
job = myqueue(queue,handle_check_race_course,ws[0].csvfilename,
|
||||||
ws[0].id,race.course.id,record.id,splitsecond=splitsecond,
|
ws[0].id,race.course.id,record.id,splitsecond=splitsecond,
|
||||||
referencespeed=record.referencespeed,coursedistance=race.course.distance)
|
# referencespeed=record.referencespeed,coursedistance=race.course.distance
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
from rowers.models import StandardCollection,CourseStandard, VirtualRaceResult,IndoorVirtualRaceResult
|
from rowers.models import (
|
||||||
|
#StandardCollection,CourseStandard,
|
||||||
|
VirtualRaceResult,IndoorVirtualRaceResult,
|
||||||
|
)
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import arrow
|
import arrow
|
||||||
|
|||||||
@@ -353,15 +353,15 @@ def handle_check_race_course(self,
|
|||||||
else:
|
else:
|
||||||
splitsecond = 0
|
splitsecond = 0
|
||||||
|
|
||||||
if 'referencespeed' in kwargs:
|
# if 'referencespeed' in kwargs:
|
||||||
referencespeed = kwargs['referencespeed']
|
# referencespeed = kwargs['referencespeed']
|
||||||
else:
|
# else:
|
||||||
referencespeed = 5.0
|
# referencespeed = 5.0
|
||||||
|
|
||||||
if 'coursedistance' in kwargs:
|
# if 'coursedistance' in kwargs:
|
||||||
coursedistance = kwargs['coursedistance']
|
# coursedistance = kwargs['coursedistance']
|
||||||
else:
|
# else:
|
||||||
coursedistance = 0
|
# coursedistance = 0
|
||||||
|
|
||||||
mode = 'race'
|
mode = 'race'
|
||||||
if 'mode' in kwargs:
|
if 'mode' in kwargs:
|
||||||
@@ -489,28 +489,30 @@ def handle_check_race_course(self,
|
|||||||
else:
|
else:
|
||||||
coursecompleted = False
|
coursecompleted = False
|
||||||
|
|
||||||
points = 0
|
# points = 0
|
||||||
if coursecompleted:
|
if coursecompleted:
|
||||||
if coursedistance == 0:
|
# if coursedistance == 0:
|
||||||
coursedistance = coursemeters
|
# coursedistance = coursemeters
|
||||||
velo = coursedistance/coursetimeseconds
|
# velo = coursedistance/coursetimeseconds
|
||||||
points = int(100*(2.-referencespeed/velo))
|
# points = int(100*(2.-referencespeed/velo))
|
||||||
query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
|
# query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
|
||||||
|
query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond} WHERE id={recordid}'.format(
|
||||||
recordid=recordid,
|
recordid=recordid,
|
||||||
duration=totaltime_sec_to_string(coursetimeseconds),
|
duration=totaltime_sec_to_string(coursetimeseconds),
|
||||||
distance=int(coursemeters),
|
distance=int(coursemeters),
|
||||||
points=points,
|
# points=points,
|
||||||
workoutid=workoutid,
|
workoutid=workoutid,
|
||||||
startsecond=startsecond,
|
startsecond=startsecond,
|
||||||
endsecond=endsecond,
|
endsecond=endsecond,
|
||||||
)
|
)
|
||||||
|
|
||||||
if mode == 'coursetest':
|
if mode == 'coursetest':
|
||||||
query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
|
# query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
|
||||||
|
query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond} WHERE id={recordid}'.format(
|
||||||
recordid=recordid,
|
recordid=recordid,
|
||||||
duration=totaltime_sec_to_string(coursetimeseconds),
|
duration=totaltime_sec_to_string(coursetimeseconds),
|
||||||
distance=int(coursemeters),
|
distance=int(coursemeters),
|
||||||
points=points,
|
# points=points,
|
||||||
workoutid=workoutid,
|
workoutid=workoutid,
|
||||||
startsecond=startsecond,
|
startsecond=startsecond,
|
||||||
endsecond=endsecond,
|
endsecond=endsecond,
|
||||||
|
|||||||
@@ -133,11 +133,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% comment %}
|
||||||
<li id="standards">
|
<li id="standards">
|
||||||
<a href="/rowers/list-standards/">
|
<a href="/rowers/list-standards/">
|
||||||
<i class="fas fa-award fa-fw"></i> Course Time Standards
|
<i class="fas fa-award fa-fw"></i> Course Time Standards
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endcomment %}
|
||||||
</ul> <!-- cd-accordion-menu -->
|
</ul> <!-- cd-accordion-menu -->
|
||||||
|
|
||||||
{% include 'menuscript.html' %}
|
{% include 'menuscript.html' %}
|
||||||
|
|||||||
@@ -104,11 +104,13 @@
|
|||||||
<th>Challenge Time Zone</th><td>{{ race.timezone }}</td>
|
<th>Challenge Time Zone</th><td>{{ race.timezone }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Standard Times</th><td><a href="/rowers/standards/{{ race.coursestandards.id }}/">{{ race.coursestandards }}</a></td>
|
<th>Standard Times</th><td><a href="/rowers/standards/{{ race.coursestandards.id }}/">{{ race.coursestandards }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
{{ race.sessionmode }} challenge
|
{{ race.sessionmode }} challenge
|
||||||
@@ -268,16 +270,20 @@
|
|||||||
<th> </th>
|
<th> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Team Name</th>
|
<th>Team Name</th>
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<th>Group</th>
|
<th>Group</th>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% endcomment %}
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th>Class</th>
|
<th>Class</th>
|
||||||
{% if race.sessiontype == 'race' %}
|
{% if race.sessiontype == 'race' %}
|
||||||
<th>Boat</th>
|
<th>Boat</th>
|
||||||
|
{% comment %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th>Time<a href="?order_by=duration">▼</th>
|
<th>Time<a href="?order_by=duration">▼</th>
|
||||||
<th>Distance<a href="?order_by=-distance">▼</th>
|
<th>Distance<a href="?order_by=-distance">▼</th>
|
||||||
@@ -296,9 +302,11 @@
|
|||||||
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
||||||
{{ result.username }}</a></td>
|
{{ result.username }}</a></td>
|
||||||
<td>{{ result.teamname }}</td>
|
<td>{{ result.teamname }}</td>
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<td>{{ result.entrycategory }}</td>
|
<td>{{ result.entrycategory }}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% endcomment %}
|
||||||
<td>{{ result.age }}</td>
|
<td>{{ result.age }}</td>
|
||||||
<td>{{ result.sex }}</td>
|
<td>{{ result.sex }}</td>
|
||||||
<td>{{ result.weightcategory }}</td>
|
<td>{{ result.weightcategory }}</td>
|
||||||
@@ -313,12 +321,16 @@
|
|||||||
{% if race.sessiontype == 'race' %}
|
{% if race.sessiontype == 'race' %}
|
||||||
<td>{{ result.boattype }}</td>
|
<td>{{ result.boattype }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% comment %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
<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>
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<td>{{ result.points }}</td>
|
<td>{{ result.points }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
<td>
|
<td>
|
||||||
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
||||||
Details</a>
|
Details</a>
|
||||||
@@ -409,10 +421,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Team Name</th>
|
<th>Team Name</th>
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<th>Group</th>
|
<th>Group</th>
|
||||||
<th>Age</th>
|
<th>Age</th>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% endcomment %}
|
||||||
{% if race.sessiontype == 'race' %}
|
{% if race.sessiontype == 'race' %}
|
||||||
<th>Boat</th>
|
<th>Boat</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -421,7 +435,9 @@
|
|||||||
<th>Gender</th>
|
<th>Gender</th>
|
||||||
<th>Weight Category</th>
|
<th>Weight Category</th>
|
||||||
<th>Adaptive</th>
|
<th>Adaptive</th>
|
||||||
|
{% comment %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
</tr>
|
</tr>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for record in records %}
|
{% for record in records %}
|
||||||
@@ -569,6 +585,7 @@
|
|||||||
review and reject entries. If you are disqualified in this
|
review and reject entries. If you are disqualified in this
|
||||||
way, you will receive an email with the reason.
|
way, you will receive an email with the reason.
|
||||||
</p>
|
</p>
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<p>
|
<p>
|
||||||
Standard Times are a way to compare results in a race category with
|
Standard Times are a way to compare results in a race category with
|
||||||
@@ -580,6 +597,7 @@
|
|||||||
be limited to those in the selected set of Standard Times.
|
be limited to those in the selected set of Standard Times.
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
as a Male crew. Check the "Mixed gender" check box to register as a
|
as a Male crew. Check the "Mixed gender" check box to register as a
|
||||||
mixed gender crew (except for 1x where this check box does nothing).
|
mixed gender crew (except for 1x where this check box does nothing).
|
||||||
</p>
|
</p>
|
||||||
|
{% comment %}
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<p>This race uses standard times and limits the race groups to those where
|
<p>This race uses standard times and limits the race groups to those where
|
||||||
standard times exist. The "Group" form choice will overrule other selections you
|
standard times exist. The "Group" form choice will overrule other selections you
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
You can check the valid race groups and standard times <a target="_" href="/rowers/standards/{{ race.coursestandards.id }}/">here</a>.
|
You can check the valid race groups and standard times <a target="_" href="/rowers/standards/{{ race.coursestandards.id }}/">here</a>.
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
{{ form.as_table }}
|
{{ form.as_table }}
|
||||||
|
|||||||
@@ -1127,10 +1127,10 @@ def virtualevent_view(request,id=0):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
adaptiveclass = ['None','PR1','PR2','PR3','FES']
|
adaptiveclass = ['None','PR1','PR2','PR3','FES']
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
entrycategory = cd['entrycategory']
|
# entrycategory = cd['entrycategory']
|
||||||
except KeyError:
|
# except KeyError:
|
||||||
entrycategory = None
|
# entrycategory = None
|
||||||
|
|
||||||
if race.sessiontype == 'race':
|
if race.sessiontype == 'race':
|
||||||
results = resultobj.objects.filter(
|
results = resultobj.objects.filter(
|
||||||
@@ -1156,8 +1156,8 @@ def virtualevent_view(request,id=0):
|
|||||||
age__lte=age_max,
|
age__lte=age_max,
|
||||||
).order_by("duration","-distance")
|
).order_by("duration","-distance")
|
||||||
|
|
||||||
if entrycategory is not None:
|
# if entrycategory is not None:
|
||||||
results = results.filter(entrycategory__in=entrycategory)
|
# results = results.filter(entrycategory__in=entrycategory)
|
||||||
|
|
||||||
# to-do - add DNS
|
# to-do - add DNS
|
||||||
dns = []
|
dns = []
|
||||||
@@ -1479,10 +1479,10 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
except VirtualRace.DoesNotExist:
|
except VirtualRace.DoesNotExist:
|
||||||
raise Http404("Virtual Challenge does not exist")
|
raise Http404("Virtual Challenge does not exist")
|
||||||
|
|
||||||
categories = None
|
# categories = None
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
# categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
# standardcollection=race.coursestandards).order_by("name")
|
||||||
|
|
||||||
|
|
||||||
if not race_can_adddiscipline(r,race):
|
if not race_can_adddiscipline(r,race):
|
||||||
@@ -1508,7 +1508,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
# we're still here
|
# we're still here
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
# process form
|
# process form
|
||||||
form = VirtualRaceResultForm(request.POST,categories=categories)
|
form = VirtualRaceResultForm(request.POST) #,categories=categories)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
teamname = cd['teamname']
|
teamname = cd['teamname']
|
||||||
@@ -1530,7 +1530,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
if sex == 'not specified':
|
if sex == 'not specified':
|
||||||
sex = 'male'
|
sex = 'male'
|
||||||
|
|
||||||
if boattype in boattypes and boatclass in boatclasses and race.coursestandards is None:
|
if boattype in boattypes and boatclass in boatclasses: # and race.coursestandards is None:
|
||||||
# check if different sexes
|
# check if different sexes
|
||||||
therecords = records.filter(
|
therecords = records.filter(
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
@@ -1551,47 +1551,47 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
|
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
coursestandard = None
|
# coursestandard = None
|
||||||
referencespeed = 5.0
|
# referencespeed = 5.0
|
||||||
|
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
coursestandard = cd['entrycategory']
|
# coursestandard = cd['entrycategory']
|
||||||
thegroups = [record.entrycategory for record in records]
|
# thegroups = [record.entrycategory for record in records]
|
||||||
if coursestandard in thegroups:
|
# if coursestandard in thegroups:
|
||||||
messages.error(request,"You have already registered in that group")
|
# messages.error(request,"You have already registered in that group")
|
||||||
url = reverse('virtualevent_view',
|
# url = reverse('virtualevent_view',
|
||||||
kwargs = {
|
# kwargs = {
|
||||||
'id': race.id
|
# 'id': race.id
|
||||||
}
|
# }
|
||||||
)
|
# )
|
||||||
|
|
||||||
return HttpResponseRedirect(url)
|
# return HttpResponseRedirect(url)
|
||||||
|
|
||||||
referencespeed = coursestandard.referencespeed
|
# referencespeed = coursestandard.referencespeed
|
||||||
boattype = coursestandard.boattype
|
# boattype = coursestandard.boattype
|
||||||
boatclass = coursestandard.boatclass
|
# boatclass = coursestandard.boatclass
|
||||||
weightcategory = coursestandard.weightclass
|
# weightcategory = coursestandard.weightclass
|
||||||
adaptiveclass = coursestandard.adaptiveclass
|
# adaptiveclass = coursestandard.adaptiveclass
|
||||||
skillclass = coursestandard.skillclass
|
# skillclass = coursestandard.skillclass
|
||||||
|
|
||||||
returnurl = reverse(virtualevent_register_view,
|
# returnurl = reverse(virtualevent_register_view,
|
||||||
kwargs={'id':race.id})
|
# kwargs={'id':race.id})
|
||||||
|
|
||||||
if age < coursestandard.agemin:
|
# if age < coursestandard.agemin:
|
||||||
messages.error(request,'You are younger than the minimum age for this group')
|
# messages.error(request,'You are younger than the minimum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if age > coursestandard.agemax:
|
# if age > coursestandard.agemax:
|
||||||
messages.error(request,'You are older than the maximum age for this group')
|
# messages.error(request,'You are older than the maximum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if sex == 'male' and coursestandard.sex != 'male':
|
# if sex == 'male' and coursestandard.sex != 'male':
|
||||||
messages.error(request,'Men are not allowed to enter this category')
|
# messages.error(request,'Men are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
# if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
||||||
messages.error(request,'Mixed crews are not allowed to enter this category')
|
# messages.error(request,'Mixed crews are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
|
|
||||||
record = VirtualRaceResult(
|
record = VirtualRaceResult(
|
||||||
@@ -1608,8 +1608,8 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
boatclass=boatclass,
|
boatclass=boatclass,
|
||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
referencespeed=referencespeed,
|
# referencespeed=referencespeed,
|
||||||
entrycategory=coursestandard,
|
# entrycategory=coursestandard,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
)
|
)
|
||||||
@@ -1639,13 +1639,13 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
'adaptiveclass': r.adaptiveclass,
|
'adaptiveclass': r.adaptiveclass,
|
||||||
}
|
}
|
||||||
|
|
||||||
categories = None
|
# categories = None
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
# categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
# standardcollection=race.coursestandards).order_by("name")
|
||||||
|
|
||||||
|
|
||||||
form = VirtualRaceResultForm(initial=initial,categories=categories)
|
form = VirtualRaceResultForm(initial=initial) #,categories=categories)
|
||||||
|
|
||||||
breadcrumbs = [
|
breadcrumbs = [
|
||||||
{
|
{
|
||||||
@@ -1706,10 +1706,10 @@ def virtualevent_register_view(request,id=0):
|
|||||||
except VirtualRace.DoesNotExist:
|
except VirtualRace.DoesNotExist:
|
||||||
raise Http404("Virtual Challenge does not exist")
|
raise Http404("Virtual Challenge does not exist")
|
||||||
|
|
||||||
categories = None
|
# categories = None
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
# categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
# standardcollection=race.coursestandards).order_by("name")
|
||||||
|
|
||||||
if not race_can_register(r,race):
|
if not race_can_register(r,race):
|
||||||
messages.error(request,"You cannot register for this race")
|
messages.error(request,"You cannot register for this race")
|
||||||
@@ -1724,7 +1724,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
# we're still here
|
# we're still here
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
# process form
|
# process form
|
||||||
form = VirtualRaceResultForm(request.POST,categories=categories)
|
form = VirtualRaceResultForm(request.POST) #,categories=categories)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
teamname = cd['teamname']
|
teamname = cd['teamname']
|
||||||
@@ -1747,36 +1747,36 @@ def virtualevent_register_view(request,id=0):
|
|||||||
sex = 'male'
|
sex = 'male'
|
||||||
|
|
||||||
|
|
||||||
coursestandard = None
|
# coursestandard = None
|
||||||
referencespeed = 5.0
|
# referencespeed = 5.0
|
||||||
|
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
coursestandard = cd['entrycategory']
|
# coursestandard = cd['entrycategory']
|
||||||
referencespeed = coursestandard.referencespeed
|
# referencespeed = coursestandard.referencespeed
|
||||||
boattype = coursestandard.boattype
|
# boattype = coursestandard.boattype
|
||||||
boatclass = coursestandard.boatclass
|
# boatclass = coursestandard.boatclass
|
||||||
weightcategory = coursestandard.weightclass
|
# weightcategory = coursestandard.weightclass
|
||||||
adaptiveclass = coursestandard.adaptiveclass
|
# adaptiveclass = coursestandard.adaptiveclass
|
||||||
skillclass = coursestandard.skillclass
|
# skillclass = coursestandard.skillclass
|
||||||
|
|
||||||
returnurl = reverse(virtualevent_register_view,
|
# returnurl = reverse(virtualevent_register_view,
|
||||||
kwargs={'id':race.id})
|
# kwargs={'id':race.id})
|
||||||
|
|
||||||
if age < coursestandard.agemin:
|
# if age < coursestandard.agemin:
|
||||||
messages.error(request,'You are younger than the minimum age for this group')
|
# messages.error(request,'You are younger than the minimum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if age > coursestandard.agemax:
|
# if age > coursestandard.agemax:
|
||||||
messages.error(request,'You are older than the maximum age for this group')
|
# messages.error(request,'You are older than the maximum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if sex == 'male' and coursestandard.sex != 'male':
|
# if sex == 'male' and coursestandard.sex != 'male':
|
||||||
messages.error(request,'Men are not allowed to enter this category')
|
# messages.error(request,'Men are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
# if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
||||||
messages.error(request,'Mixed crews are not allowed to enter this category')
|
# messages.error(request,'Mixed crews are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1796,8 +1796,8 @@ def virtualevent_register_view(request,id=0):
|
|||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
entrycategory=coursestandard,
|
# entrycategory=coursestandard,
|
||||||
referencespeed=referencespeed,
|
# referencespeed=referencespeed,
|
||||||
)
|
)
|
||||||
|
|
||||||
record.save()
|
record.save()
|
||||||
@@ -1841,12 +1841,12 @@ def virtualevent_register_view(request,id=0):
|
|||||||
'adaptiveclass': r.adaptiveclass,
|
'adaptiveclass': r.adaptiveclass,
|
||||||
}
|
}
|
||||||
|
|
||||||
categories = None
|
# categories = None
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
# categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
# standardcollection=race.coursestandards).order_by("name")
|
||||||
|
|
||||||
form = VirtualRaceResultForm(initial=initial,categories=categories)
|
form = VirtualRaceResultForm(initial=initial) #,categories=categories)
|
||||||
|
|
||||||
breadcrumbs = [
|
breadcrumbs = [
|
||||||
{
|
{
|
||||||
@@ -1948,10 +1948,10 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
except VirtualRace.DoesNotExist:
|
except VirtualRace.DoesNotExist:
|
||||||
raise Http404("Virtual Challenge does not exist")
|
raise Http404("Virtual Challenge does not exist")
|
||||||
|
|
||||||
categories = None
|
# categories = None
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
# categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
# standardcollection=race.coursestandards).order_by("name")
|
||||||
|
|
||||||
if not race_can_register(r,race):
|
if not race_can_register(r,race):
|
||||||
messages.error(request,"You cannot register for this race")
|
messages.error(request,"You cannot register for this race")
|
||||||
@@ -1966,7 +1966,7 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
# we're still here
|
# we're still here
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
# process form
|
# process form
|
||||||
form = IndoorVirtualRaceResultForm(request.POST,categories=categories)
|
form = IndoorVirtualRaceResultForm(request.POST) #,categories=categories)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
teamname = cd['teamname']
|
teamname = cd['teamname']
|
||||||
@@ -1984,35 +1984,35 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
if sex == 'not specified':
|
if sex == 'not specified':
|
||||||
sex = 'male'
|
sex = 'male'
|
||||||
|
|
||||||
coursestandard = None
|
# coursestandard = None
|
||||||
referencespeed = 5.0
|
# referencespeed = 5.0
|
||||||
|
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
coursestandard = cd['entrycategory']
|
# coursestandard = cd['entrycategory']
|
||||||
referencespeed = coursestandard.referencespeed
|
# referencespeed = coursestandard.referencespeed
|
||||||
boatclass = coursestandard.boatclass
|
# boatclass = coursestandard.boatclass
|
||||||
weightcategory = coursestandard.weightclass
|
# weightcategory = coursestandard.weightclass
|
||||||
adaptiveclass = coursestandard.adaptiveclass
|
# adaptiveclass = coursestandard.adaptiveclass
|
||||||
skillclass = coursestandard.skillclass
|
# skillclass = coursestandard.skillclass
|
||||||
|
|
||||||
returnurl = reverse(virtualevent_register_view,
|
# returnurl = reverse(virtualevent_register_view,
|
||||||
kwargs={'id':race.id})
|
# kwargs={'id':race.id})
|
||||||
|
|
||||||
if age < coursestandard.agemin:
|
# if age < coursestandard.agemin:
|
||||||
messages.error(request,'You are younger than the minimum age for this group')
|
# messages.error(request,'You are younger than the minimum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if age > coursestandard.agemax:
|
# if age > coursestandard.agemax:
|
||||||
messages.error(request,'You are older than the maximum age for this group')
|
# messages.error(request,'You are older than the maximum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if sex == 'male' and coursestandard.sex != 'male':
|
# if sex == 'male' and coursestandard.sex != 'male':
|
||||||
messages.error(request,'Men are not allowed to enter this category')
|
# messages.error(request,'Men are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
# if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
||||||
messages.error(request,'Mixed crews are not allowed to enter this category')
|
# messages.error(request,'Mixed crews are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
# return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2031,8 +2031,8 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
entrycategory=coursestandard,
|
# entrycategory=coursestandard,
|
||||||
referencespeed=referencespeed
|
# referencespeed=referencespeed
|
||||||
)
|
)
|
||||||
|
|
||||||
record.save()
|
record.save()
|
||||||
@@ -2076,12 +2076,12 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
'adaptiveclass': r.adaptiveclass,
|
'adaptiveclass': r.adaptiveclass,
|
||||||
}
|
}
|
||||||
|
|
||||||
categories = None
|
# categories = None
|
||||||
if race.coursestandards is not None:
|
# if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
# categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
# standardcollection=race.coursestandards).order_by("name")
|
||||||
|
|
||||||
form = IndoorVirtualRaceResultForm(initial=initial,categories=categories)
|
form = IndoorVirtualRaceResultForm(initial=initial) #,categories=categories)
|
||||||
|
|
||||||
breadcrumbs = [
|
breadcrumbs = [
|
||||||
{
|
{
|
||||||
@@ -2154,7 +2154,7 @@ def indoorvirtualevent_create_view(request):
|
|||||||
evaluation_closure = cd['evaluation_closure']
|
evaluation_closure = cd['evaluation_closure']
|
||||||
contact_phone = cd['contact_phone']
|
contact_phone = cd['contact_phone']
|
||||||
contact_email = cd['contact_email']
|
contact_email = cd['contact_email']
|
||||||
coursestandards = cd['coursestandards']
|
# coursestandards = cd['coursestandards']
|
||||||
|
|
||||||
# correct times
|
# correct times
|
||||||
|
|
||||||
@@ -2209,7 +2209,7 @@ def indoorvirtualevent_create_view(request):
|
|||||||
sessionvalue = sessionvalue,
|
sessionvalue = sessionvalue,
|
||||||
course=None,
|
course=None,
|
||||||
timezone=timezone_str,
|
timezone=timezone_str,
|
||||||
coursestandards=coursestandards,
|
# coursestandards=coursestandards,
|
||||||
evaluation_closure=evaluation_closure,
|
evaluation_closure=evaluation_closure,
|
||||||
registration_closure=registration_closure,
|
registration_closure=registration_closure,
|
||||||
contact_phone=contact_phone,
|
contact_phone=contact_phone,
|
||||||
@@ -2296,7 +2296,7 @@ def virtualevent_create_view(request):
|
|||||||
evaluation_closure = cd['evaluation_closure']
|
evaluation_closure = cd['evaluation_closure']
|
||||||
contact_phone = cd['contact_phone']
|
contact_phone = cd['contact_phone']
|
||||||
contact_email = cd['contact_email']
|
contact_email = cd['contact_email']
|
||||||
coursestandards = cd['coursestandards']
|
# coursestandards = cd['coursestandards']
|
||||||
|
|
||||||
# correct times
|
# correct times
|
||||||
|
|
||||||
@@ -2348,7 +2348,7 @@ def virtualevent_create_view(request):
|
|||||||
evaluation_closure=evaluation_closure,
|
evaluation_closure=evaluation_closure,
|
||||||
registration_closure=registration_closure,
|
registration_closure=registration_closure,
|
||||||
contact_phone=contact_phone,
|
contact_phone=contact_phone,
|
||||||
coursestandards=coursestandards,
|
# coursestandards=coursestandards,
|
||||||
contact_email=contact_email,
|
contact_email=contact_email,
|
||||||
country = course.country,
|
country = course.country,
|
||||||
manager=request.user,
|
manager=request.user,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ from rowers.forms import (
|
|||||||
EmailForm, RegistrationForm, RegistrationFormTermsOfService,
|
EmailForm, RegistrationForm, RegistrationFormTermsOfService,
|
||||||
RegistrationFormUniqueEmail,RegistrationFormSex,
|
RegistrationFormUniqueEmail,RegistrationFormSex,
|
||||||
CNsummaryForm,UpdateWindForm,
|
CNsummaryForm,UpdateWindForm,
|
||||||
StandardsForm,
|
# StandardsForm,
|
||||||
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
|
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
|
||||||
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
||||||
TrendFlexModalForm,WorkoutSplitForm,WorkoutJoinParamForm,
|
TrendFlexModalForm,WorkoutSplitForm,WorkoutJoinParamForm,
|
||||||
@@ -115,7 +115,7 @@ from rowers.models import (
|
|||||||
AlertEditForm, ConditionEditForm,
|
AlertEditForm, ConditionEditForm,
|
||||||
PlannedSessionComment,CoachRequest,CoachOffer,
|
PlannedSessionComment,CoachRequest,CoachOffer,
|
||||||
VideoAnalysis,ShareKey,
|
VideoAnalysis,ShareKey,
|
||||||
StandardCollection,CourseStandard,
|
# StandardCollection,CourseStandard,
|
||||||
)
|
)
|
||||||
from rowers.models import (
|
from rowers.models import (
|
||||||
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,
|
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,
|
||||||
|
|||||||
Reference in New Issue
Block a user