seems to be complete now
This commit is contained in:
@@ -1041,8 +1041,8 @@ def race_can_edit(r,race):
|
||||
return False
|
||||
|
||||
def race_can_submit(r,race):
|
||||
if r not in race.rower.all():
|
||||
return False
|
||||
#if r not in race.rower.all():
|
||||
# return False
|
||||
|
||||
start_time = race.start_time
|
||||
start_date = race.startdate
|
||||
@@ -1451,12 +1451,34 @@ def add_workout_indoorrace(ws,race,r,recordid=0,doregister=False):
|
||||
else:
|
||||
age = None
|
||||
|
||||
record = IndoorVirtualRaceResult.objects.get(
|
||||
userid=r.id,
|
||||
race=race,
|
||||
id=recordid
|
||||
)
|
||||
|
||||
try:
|
||||
record = IndoorVirtualRaceResult.objects.get(
|
||||
userid=r.id,
|
||||
race=race,
|
||||
id=recordid
|
||||
)
|
||||
except IndoorVirtualRaceResult.DoesNotExist:
|
||||
if doregister:
|
||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,ws[0],race)
|
||||
if hasinitial:
|
||||
record = IndoorVirtualRaceResult(
|
||||
userid = r.id,
|
||||
username = r.user.first_name+' '+r.user.last_name,
|
||||
weightcategory=weightclass,
|
||||
adaptiveclass=adaptiveclass,
|
||||
race=race,
|
||||
boatclass=boatclass,
|
||||
sex=sex,
|
||||
age = age,
|
||||
entrycategory=initialcategory,
|
||||
)
|
||||
record.save()
|
||||
else:
|
||||
errors.append("Unable to find a suitable start category")
|
||||
return result,comments,errors,0
|
||||
else:
|
||||
errors.append("Couldn't find this entry")
|
||||
return result,comments,errors,0
|
||||
|
||||
records = IndoorVirtualRaceResult.objects.filter(
|
||||
userid=r.id,
|
||||
@@ -1466,11 +1488,8 @@ def add_workout_indoorrace(ws,race,r,recordid=0,doregister=False):
|
||||
|
||||
|
||||
|
||||
if not record and not doregister:
|
||||
errors.append("Couldn't find this entry")
|
||||
return result,comments,errors,0
|
||||
elif not record:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
if race.sessionmode == 'distance':
|
||||
@@ -1584,11 +1603,35 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0,doregister=False):
|
||||
else:
|
||||
age = None
|
||||
|
||||
record = VirtualRaceResult.objects.get(
|
||||
userid=r.id,
|
||||
race=race,
|
||||
id=recordid
|
||||
)
|
||||
try:
|
||||
record = VirtualRaceResult.objects.get(
|
||||
userid=r.id,
|
||||
race=race,
|
||||
id=recordid
|
||||
)
|
||||
except VirtualRaceResult.DoesNotExist:
|
||||
if doregister:
|
||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,ws[0],race)
|
||||
if hasinitial:
|
||||
record = VirtualRaceResult(
|
||||
userid = r.id,
|
||||
username = r.user.first_name+' '+r.user.last_name,
|
||||
weightcategory=weightclass,
|
||||
adaptiveclass=adaptiveclass,
|
||||
race=race,
|
||||
boatclass=boatclass,
|
||||
boattype=boattype,
|
||||
sex=sex,
|
||||
age = age,
|
||||
entrycategory=initialcategory,
|
||||
)
|
||||
record.save()
|
||||
else:
|
||||
errors.append("Unable to find a suitable start category")
|
||||
return result,comments,errors,0
|
||||
else:
|
||||
errors.append("Couldn't find this entry")
|
||||
return result,comments,errors,0
|
||||
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
userid=r.id,
|
||||
@@ -1656,6 +1699,8 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0,doregister=False):
|
||||
referencespeed=record.referencespeed,coursedistance=race.course.distance
|
||||
)
|
||||
|
||||
comments.append('We are now checking adherence to the race course. This may take a few minutes to complete')
|
||||
|
||||
|
||||
|
||||
add_workouts_plannedsession(ws,race,r)
|
||||
|
||||
Reference in New Issue
Block a user