bug fixes and race result on submit
This commit is contained in:
@@ -473,9 +473,12 @@ def update_virtualrace(ps,cd):
|
||||
ps.evaluation_closure = pytz.timezone(timezone_str).localize(
|
||||
ps.evaluation_closure.replace(tzinfo=None)
|
||||
)
|
||||
ps.registration_closure = pytz.timezone(timezone_str).localize(
|
||||
ps.registration_closure.replace(tzinfo=None)
|
||||
)
|
||||
try:
|
||||
ps.registration_closure = pytz.timezone(timezone_str).localize(
|
||||
ps.registration_closure.replace(tzinfo=None)
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
ps.timezone = timezone_str
|
||||
|
||||
@@ -688,21 +691,28 @@ def add_workout_race(ws,race,r):
|
||||
return result,comments,errors
|
||||
|
||||
duration = totaltime_sec_to_string(coursetime)
|
||||
|
||||
record = VirtualRaceResult(
|
||||
user=r,
|
||||
username=username,
|
||||
workout = ws[0],
|
||||
race = race,
|
||||
coursecompleted=coursecompleted,
|
||||
duration = duration,
|
||||
boattype = ws[0].boattype,
|
||||
sex = r.sex,
|
||||
age = age,
|
||||
)
|
||||
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
user=r,
|
||||
race=race
|
||||
)
|
||||
|
||||
record = records[0]
|
||||
|
||||
if ws[0].boattype != record.boattype:
|
||||
errors.append('Your workout boat type did not match the boat type you registered')
|
||||
return result,comments,errors
|
||||
|
||||
if ws[0].weightcategory != record.weightcategory:
|
||||
errors.append('Your workout weight category did not match the weight category you registered')
|
||||
return result,comments, errors
|
||||
|
||||
record.coursecompleted=coursecompleted
|
||||
record.workout=ws[0]
|
||||
record.duration = duration
|
||||
record.save()
|
||||
|
||||
|
||||
|
||||
|
||||
return result,comments,errors
|
||||
|
||||
Reference in New Issue
Block a user