add boat for virutal race improvements
This commit is contained in:
@@ -438,7 +438,7 @@ def add_workouts_plannedsession(ws,ps,r):
|
||||
ids = [w.id for w in wold] + [w.id for w in ws]
|
||||
ids = list(set(ids))
|
||||
|
||||
if len(ids)>1 and ps.sessiontype in ['test','coursetest','race']:
|
||||
if len(ids)>1 and ps.sessiontype in ['test','coursetest','race','fastest_time','fastest_distance']:
|
||||
errors.append('For tests, you can only attach one workout')
|
||||
return result,comments,errors
|
||||
|
||||
@@ -1199,7 +1199,7 @@ def race_rower_status(r,race):
|
||||
has_registered = False
|
||||
is_complete = False
|
||||
|
||||
if race.sessiontype == 'race':
|
||||
if race.sessiontype in ['race']:
|
||||
resultobj = VirtualRaceResult
|
||||
else:
|
||||
resultobj = IndoorVirtualRaceResult
|
||||
@@ -1308,10 +1308,15 @@ def race_can_resubmit(r,race):
|
||||
|
||||
def race_can_adddiscipline(r,race):
|
||||
|
||||
if race.sessiontype != 'race':
|
||||
if race.sessiontype not in ['race','fastest_time','fastest_distance']:
|
||||
return False
|
||||
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
if race.sessiontype == ['race']:
|
||||
resultobj = VirtualRaceResult
|
||||
else:
|
||||
resultobj = IndoorVirtualRaceResult
|
||||
|
||||
records = resultobj.objects.filter(
|
||||
userid=r.id,
|
||||
race=race)
|
||||
|
||||
@@ -1319,6 +1324,7 @@ def race_can_adddiscipline(r,race):
|
||||
return False
|
||||
|
||||
|
||||
|
||||
start_time = race.start_time
|
||||
start_date = race.startdate
|
||||
startdatetime = datetime.combine(start_date,start_time)
|
||||
@@ -1341,7 +1347,7 @@ def race_can_adddiscipline(r,race):
|
||||
|
||||
|
||||
def race_can_withdraw(r,race):
|
||||
if race.sessiontype == 'race':
|
||||
if race.sessiontype in ['race']:
|
||||
recordobj = VirtualRaceResult
|
||||
else:
|
||||
recordobj = IndoorVirtualRaceResult
|
||||
@@ -1500,7 +1506,7 @@ def email_submit_race(r,race,workoutid):
|
||||
|
||||
|
||||
def race_can_register(r,race):
|
||||
if race.sessiontype == 'race':
|
||||
if race.sessiontype in ['race']:
|
||||
recordobj = VirtualRaceResult
|
||||
else:
|
||||
recordobj = IndoorVirtualRaceResult
|
||||
@@ -1537,7 +1543,7 @@ def add_rower_race(r,race):
|
||||
def remove_rower_race(r,race,recordid=None):
|
||||
race.rower.remove(r)
|
||||
|
||||
if race.sessiontype == 'race':
|
||||
if race.sessiontype in ['race']:
|
||||
recordobj = VirtualRaceResult
|
||||
else:
|
||||
recordobj = IndoorVirtualRaceResult
|
||||
@@ -1835,7 +1841,7 @@ def add_workout_indoorrace(ws,race,r,recordid=0,doregister=False):
|
||||
ids = [w.id for w in ws]
|
||||
ids = list(set(ids))
|
||||
|
||||
if len(ids)>1 and race.sessiontype in ['test','coursetest','race','indoorrace']:
|
||||
if len(ids)>1 and race.sessiontype in ['test','coursetest','race','indoorrace','fastest_time','fastest_distance']:
|
||||
errors.append('For tests, you can only attach one workout')
|
||||
return result,comments,errors,0
|
||||
|
||||
@@ -1983,7 +1989,7 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0,doregister=False):
|
||||
ids = [w.id for w in ws]
|
||||
ids = list(set(ids))
|
||||
|
||||
if len(ids)>1 and race.sessiontype in ['test','coursetest','race']:
|
||||
if len(ids)>1 and race.sessiontype in ['test','coursetest','race','fastest_time','fastest_distance']:
|
||||
errors.append('For tests, you can only attach one workout')
|
||||
return result,comments,errors,0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user