fix
This commit is contained in:
@@ -3253,6 +3253,11 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
max_length=40,
|
max_length=40,
|
||||||
default='rower',
|
default='rower',
|
||||||
verbose_name = 'Ergometer Class')
|
verbose_name = 'Ergometer Class')
|
||||||
|
|
||||||
|
boattype = models.CharField(choices=boattypes,max_length=40,
|
||||||
|
default='1x',
|
||||||
|
verbose_name = 'Boat Type'
|
||||||
|
)
|
||||||
coursecompleted = models.BooleanField(default=False)
|
coursecompleted = models.BooleanField(default=False)
|
||||||
sex = models.CharField(default="not specified",
|
sex = models.CharField(default="not specified",
|
||||||
max_length=30,
|
max_length=30,
|
||||||
|
|||||||
@@ -1470,7 +1470,7 @@ def default_class(r,w,race):
|
|||||||
adaptiveclass = w.adaptiveclass
|
adaptiveclass = w.adaptiveclass
|
||||||
weightclass = w.weightcategory
|
weightclass = w.weightcategory
|
||||||
else:
|
else:
|
||||||
if race.sessiontype == 'race':
|
if race.sessiontype in ['race','fastest_time','fastest_meters']:
|
||||||
boatclass = 'water'
|
boatclass = 'water'
|
||||||
else:
|
else:
|
||||||
boatclass = 'rower'
|
boatclass = 'rower'
|
||||||
@@ -1486,9 +1486,11 @@ def default_class(r,w,race):
|
|||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
weightclass=weightclass,
|
weightclass=weightclass,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
|
standardcollection = race.coursestandards,
|
||||||
).order_by("agemax","-agemin","boattype","sex")
|
).order_by("agemax","-agemin","boattype","sex")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
# omit weight
|
# omit weight
|
||||||
standards = CourseStandard.objects.filter(
|
standards = CourseStandard.objects.filter(
|
||||||
@@ -1497,33 +1499,41 @@ def default_class(r,w,race):
|
|||||||
adaptiveclass=adaptiveclass,
|
adaptiveclass=adaptiveclass,
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
|
standardcollection = race.coursestandards,
|
||||||
).order_by(
|
).order_by(
|
||||||
"agemax","-agemin","boattype","sex","weightclass",
|
"agemax","-agemin","boattype","sex","weightclass",
|
||||||
"referencespeed"
|
"referencespeed"
|
||||||
)
|
)
|
||||||
|
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
# omit adaptive class
|
# omit adaptive class
|
||||||
standards = CourseStandard.objects.filter(
|
standards = CourseStandard.objects.filter(
|
||||||
agemin__lt=age,agemax__gt=age,
|
agemin__lt=age,agemax__gt=age,
|
||||||
boattype=boattype,sex=sex,
|
boattype=boattype,sex=sex,
|
||||||
|
standardcollection = race.coursestandards,
|
||||||
).order_by(
|
).order_by(
|
||||||
"agemax","-agemin","boattype","sex",
|
"agemax","-agemin","boattype","sex",
|
||||||
"weightclass","referencespeed")
|
"weightclass","referencespeed")
|
||||||
|
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
# omit boattype
|
# omit boattype
|
||||||
standards = CourseStandard.objects.filter(
|
standards = CourseStandard.objects.filter(
|
||||||
agemin__lt=age,agemax__gt=age,sex=sex,
|
agemin__lt=age,agemax__gt=age,sex=sex,
|
||||||
|
standardcollection = race.coursestandards,
|
||||||
).order_by(
|
).order_by(
|
||||||
"agemax","-agemin","boattype","sex",
|
"agemax","-agemin","boattype","sex",
|
||||||
"weightclass","referencespeed")
|
"weightclass","referencespeed")
|
||||||
|
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
# omit boattype
|
# omit boattype
|
||||||
standards = CourseStandard.objects.filter(
|
standards = CourseStandard.objects.filter(
|
||||||
agemin__lt=age,agemax__gt=age,sex='male',
|
agemin__lt=age,agemax__gt=age,sex='male',
|
||||||
|
standardcollection = race.coursestandards
|
||||||
).order_by(
|
).order_by(
|
||||||
"agemax","-agemin","boattype","sex",
|
"agemax","-agemin","boattype","sex",
|
||||||
"weightclass","referencespeed")
|
"weightclass","referencespeed")
|
||||||
|
|
||||||
|
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
# boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,
|
# boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,
|
||||||
return False,'1x','water',None,'hwt','male',5.0,None
|
return False,'1x','water',None,'hwt','male',5.0,None
|
||||||
|
|||||||
@@ -1325,7 +1325,6 @@ def virtualevent_view(request,id=0):
|
|||||||
|
|
||||||
records = resultobj.objects.filter(race=race)
|
records = resultobj.objects.filter(race=race)
|
||||||
|
|
||||||
|
|
||||||
buttons = []
|
buttons = []
|
||||||
|
|
||||||
# to-do - add DNS
|
# to-do - add DNS
|
||||||
@@ -2055,6 +2054,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
|
|
||||||
categories = None
|
categories = None
|
||||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,None,race)
|
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,None,race)
|
||||||
|
|
||||||
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")
|
||||||
@@ -2069,6 +2069,11 @@ def virtualevent_register_view(request,id=0):
|
|||||||
|
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
if race.sessiontype == 'race':
|
||||||
|
resultobj = VirtualRaceResult
|
||||||
|
else:
|
||||||
|
resultobj = IndoorVirtualRaceResult
|
||||||
|
|
||||||
# we're still here
|
# we're still here
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
# process form
|
# process form
|
||||||
@@ -2129,7 +2134,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
record = VirtualRaceResult(
|
record = resultobj(
|
||||||
userid=r.id,
|
userid=r.id,
|
||||||
teamname=teamname,
|
teamname=teamname,
|
||||||
race=race,
|
race=race,
|
||||||
@@ -3320,7 +3325,7 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0):
|
|||||||
|
|
||||||
if selectedworkout is not None:
|
if selectedworkout is not None:
|
||||||
workouts = Workout.objects.filter(id=selectedworkout)
|
workouts = Workout.objects.filter(id=selectedworkout)
|
||||||
|
|
||||||
if race.sessiontype == 'race':
|
if race.sessiontype == 'race':
|
||||||
result,comments,errors,jobid = add_workout_race(
|
result,comments,errors,jobid = add_workout_race(
|
||||||
workouts,race,r,
|
workouts,race,r,
|
||||||
@@ -3616,7 +3621,6 @@ def virtualevent_entry_edit_view(request,id=0,entryid=0):
|
|||||||
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)
|
||||||
|
|
||||||
print(sex,coursestandard.sex)
|
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user