Private
Public Access
1
0

register and withdraw done

This commit is contained in:
Sander Roosendaal
2018-04-19 13:28:12 +02:00
parent 8bb50596a2
commit 6a9b61bef3
5 changed files with 270 additions and 13 deletions

View File

@@ -477,6 +477,7 @@ def update_virtualrace(ps,cd):
ps.registration_closure.replace(tzinfo=None)
)
ps.timezone = timezone_str
ps.save()
@@ -488,6 +489,110 @@ def race_rower_status(r,race):
is_complete = is_session_complete_ws(ws,race)[1]
has_registered = r in race.rower
has_registered = r in race.rower.all()
return is_complete,has_registered
def race_can_submit(r,race):
if r not in race.rower.all():
return False
start_time = race.start_time
start_date = race.startdate
startdatetime = datetime.combine(start_date,start_time)
startdatetime = pytz.timezone(race.timezone).localize(
startdatetime
)
evaluation_closure = race.evaluation_closure
if timezone.now() > startdatetime and timezone.now() < evaluation_closure:
is_complete,has_registered = race_rower_status(r,race)
if is_complete == 'not done':
return True
else:
return False
else:
return False
return False
def race_can_resubmit(r,race):
if r not in race.rower.all():
return False
start_time = race.start_time
start_date = race.startdate
startdatetime = datetime.combine(start_date,start_time)
startdatetime = pytz.timezone(race.timezone).localize(
startdatetime
)
evaluation_closure = race.evaluation_closure
if timezone.now() > startdatetime and timezone.now() < evaluation_closure:
is_complete,has_registered = race_rower_status(r,race)
if is_complete in ['partial','completed']:
return True
else:
return False
else:
return False
return False
def race_can_withdraw(r,race):
if r not in race.rower.all():
return False
start_time = race.start_time
start_date = race.startdate
startdatetime = datetime.combine(start_date,start_time)
startdatetime = pytz.timezone(race.timezone).localize(
startdatetime
)
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
return True
def race_can_register(r,race):
if r in race.rower.all():
return False
start_time = race.start_time
start_date = race.startdate
startdatetime = datetime.combine(start_date,start_time)
startdatetime = pytz.timezone(race.timezone).localize(
startdatetime
)
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
return True
def add_rower_race(r,race):
race.rower.add(r)
race.save()
return 1
def remove_rower_race(r,race):
race.rower.remove(r)
return 1