race registration rules more flexible
This commit is contained in:
@@ -473,12 +473,26 @@ 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
|
||||
|
||||
registration_form = cd['registration_form']
|
||||
registration_closure = cd['registration_closure']
|
||||
if registration_form == 'manual':
|
||||
try:
|
||||
registration_closure = pytz.timezone(
|
||||
timezone_str
|
||||
).localize(
|
||||
registration_closure.replace(tzinfo=None)
|
||||
)
|
||||
except AttributeError:
|
||||
registration_closure = startdatetime
|
||||
elif registration_form == 'windowstart':
|
||||
registration_closure = startdatetime
|
||||
elif registration_form == 'windowend':
|
||||
registration_closure = enddatetime
|
||||
else:
|
||||
registration_closure = evaluation_closure
|
||||
|
||||
ps.registration_closure = registration_closure
|
||||
|
||||
ps.timezone = timezone_str
|
||||
|
||||
@@ -553,6 +567,7 @@ def race_can_resubmit(r,race):
|
||||
evaluation_closure = race.evaluation_closure
|
||||
|
||||
|
||||
|
||||
if timezone.now() > startdatetime and timezone.now() < evaluation_closure:
|
||||
is_complete,has_registered = race_rower_status(r,race)
|
||||
return is_complete
|
||||
@@ -573,11 +588,11 @@ def race_can_withdraw(r,race):
|
||||
)
|
||||
|
||||
registration_closure = race.registration_closure
|
||||
if registration_closure is not None and registration_closure != '':
|
||||
if timezone.now() > registration_closure:
|
||||
return False
|
||||
elif timezone.now() > startdatetime:
|
||||
return False
|
||||
if registration_closure is None or registration_closure == '':
|
||||
registration_closure = startdatetime
|
||||
|
||||
if timezone.now() > registration_closure:
|
||||
return False
|
||||
elif timezone.now() > startdatetime:
|
||||
return False
|
||||
|
||||
@@ -595,13 +610,11 @@ def race_can_register(r,race):
|
||||
)
|
||||
|
||||
registration_closure = race.registration_closure
|
||||
if registration_closure is not None and registration_closure != '':
|
||||
if timezone.now() > registration_closure:
|
||||
return False
|
||||
elif timezone.now() > startdatetime:
|
||||
return False
|
||||
elif timezone.now() > startdatetime:
|
||||
return False
|
||||
if registration_closure is None or registration_closure == '':
|
||||
registration_closure = startdatetime
|
||||
|
||||
if timezone.now() > registration_closure:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user