Private
Public Access
1
0

bug fixes and race result on submit

This commit is contained in:
Sander Roosendaal
2018-04-20 14:03:15 +02:00
parent 7f7fbc9112
commit d6cc7430ed
2 changed files with 33 additions and 19 deletions

View File

@@ -473,9 +473,12 @@ def update_virtualrace(ps,cd):
ps.evaluation_closure = pytz.timezone(timezone_str).localize(
ps.evaluation_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
@@ -689,22 +692,29 @@ def add_workout_race(ws,race,r):
duration = totaltime_sec_to_string(coursetime)
record = VirtualRaceResult(
records = VirtualRaceResult.objects.filter(
user=r,
username=username,
workout = ws[0],
race = race,
coursecompleted=coursecompleted,
duration = duration,
boattype = ws[0].boattype,
sex = r.sex,
age = age,
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
def delete_race_result(workout,race):

View File

@@ -13581,10 +13581,14 @@ def virtualevent_create_view(request):
evaluation_closure = pytz.timezone(timezone_str).localize(
evaluation_closure.replace(tzinfo=None)
)
registration_closure = pytz.timezone(timezone_str).localize(
try:
registration_closure = pytz.timezone(
timezone_str
).localize(
registration_closure.replace(tzinfo=None)
)
except AttributeError:
pass
vs = VirtualRace(