started registration form processing on OTW events - not working yet
This commit is contained in:
@@ -2206,7 +2206,7 @@ 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="")
|
||||||
coursestandard = 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
|
||||||
@@ -2966,7 +2966,7 @@ class VirtualRaceResult(models.Model):
|
|||||||
startsecond = models.FloatField(default=0)
|
startsecond = models.FloatField(default=0)
|
||||||
endsecond = models.FloatField(default=0)
|
endsecond = models.FloatField(default=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='Field')
|
verbose_name='Group')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
@@ -3012,6 +3012,7 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
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)
|
||||||
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,
|
||||||
@@ -3027,7 +3028,7 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
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='Category')
|
verbose_name='Group')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def save_scoring(name,user,filename,id=0,notes=""):
|
|||||||
delta = datetime.timedelta(hours=t.hour, minutes=t.minute, seconds=t.second,microseconds=t.microsecond)
|
delta = datetime.timedelta(hours=t.hour, minutes=t.minute, seconds=t.second,microseconds=t.microsecond)
|
||||||
seconds = delta.total_seconds()
|
seconds = delta.total_seconds()
|
||||||
|
|
||||||
coursestandard = coursedistance/seconds
|
referencespeed = coursedistance/seconds
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ def save_scoring(name,user,filename,id=0,notes=""):
|
|||||||
standard = CourseStandard(
|
standard = CourseStandard(
|
||||||
name=name,
|
name=name,
|
||||||
coursedistance=coursedistance,
|
coursedistance=coursedistance,
|
||||||
coursestandard=coursestandard,
|
referencespeed=referencespeed,
|
||||||
coursetime=coursetime,
|
coursetime=coursetime,
|
||||||
agemin=agemin,
|
agemin=agemin,
|
||||||
agemax=agemax,
|
agemax=agemax,
|
||||||
|
|||||||
@@ -1631,6 +1631,40 @@ def virtualevent_register_view(request,id=0):
|
|||||||
if sex == 'not specified':
|
if sex == 'not specified':
|
||||||
sex = 'male'
|
sex = 'male'
|
||||||
|
|
||||||
|
|
||||||
|
coursestandard = None
|
||||||
|
referencespeed = 5.0
|
||||||
|
|
||||||
|
if race.coursestandards is not None:
|
||||||
|
coursestandard = cd['entrycategory']
|
||||||
|
referencespeed = coursestandard.referencespeed
|
||||||
|
boattype = coursestandard.boattype
|
||||||
|
boatclass = coursestandard.boatclass
|
||||||
|
weightcategory = coursestandard.weightcategory
|
||||||
|
adaptiveclass = coursestandard.adaptiveclass
|
||||||
|
skillclass = coursestandard.skillclass
|
||||||
|
|
||||||
|
returnurl = reverse(virtualevent_register_view,
|
||||||
|
kwargs={'id':race.id})
|
||||||
|
|
||||||
|
if age < coursestandard.agemin:
|
||||||
|
messages.error(request,'You are younger than the minimum age for this group')
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
if age > coursestandard.agemax:
|
||||||
|
messages.error(request,'You are older than the maximum age for this group')
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
if sex == 'male' and coursestandard.sex != 'male':
|
||||||
|
messages.error(request,'Men are not allowed to enter this category')
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
||||||
|
messages.error(request,'Mixed crews are not allowed to enter this category')
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
record = VirtualRaceResult(
|
record = VirtualRaceResult(
|
||||||
userid=r.id,
|
userid=r.id,
|
||||||
teamname=teamname,
|
teamname=teamname,
|
||||||
@@ -1646,7 +1680,8 @@ def virtualevent_register_view(request,id=0):
|
|||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age
|
age=age,
|
||||||
|
entrycategory=coursestandard,
|
||||||
)
|
)
|
||||||
|
|
||||||
record.save()
|
record.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user