|
|
|
|
@ -1540,11 +1540,10 @@ class Tournament(BaseModel): |
|
|
|
|
if self.automatic_waiting_list() is False: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
config = settings.TOURNAMENT_SETTINGS['TIME_TO_CONFIRM'] |
|
|
|
|
config = settings.TOURNAMENT_SETTINGS |
|
|
|
|
TIME_PROXIMITY_RULES = config['TIME_PROXIMITY_RULES'] |
|
|
|
|
WAITING_LIST_RULES = config['WAITING_LIST_RULES'] |
|
|
|
|
BUSINESS_RULES = config['BUSINESS_RULES'] |
|
|
|
|
URGENCY_OVERRIDE = config['URGENCY_OVERRIDE'] |
|
|
|
|
|
|
|
|
|
# 1. Get current time in tournament's timezone |
|
|
|
|
current_time = timezone.now() |
|
|
|
|
@ -1579,11 +1578,6 @@ class Tournament(BaseModel): |
|
|
|
|
|
|
|
|
|
# 6. Use the more restrictive rule (smaller time window) |
|
|
|
|
minutes_to_confirm = min(time_based_minutes, waitlist_based_minutes) |
|
|
|
|
live_testing = getattr(settings, 'LIVE_TESTING', False) |
|
|
|
|
# Divide by 10 if LIVE_TESTING is enabled |
|
|
|
|
if live_testing: |
|
|
|
|
minutes_to_confirm = minutes_to_confirm / 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 7. Check urgency overrides |
|
|
|
|
apply_business_rules = True |
|
|
|
|
@ -1605,11 +1599,18 @@ class Tournament(BaseModel): |
|
|
|
|
# 24 hours before tournament: 7am - 10pm |
|
|
|
|
business_start_hour = 7 |
|
|
|
|
business_end_hour = 22 |
|
|
|
|
minutes_to_confirm = config.MINIMUM_RESPONSE_TIME |
|
|
|
|
|
|
|
|
|
if hours_until_tournament <= 12: |
|
|
|
|
# 12 hours before tournament: 6am - 1am (next day) |
|
|
|
|
business_start_hour = 6 |
|
|
|
|
business_end_hour = 25 # 1am next day (25 in 24-hour format) |
|
|
|
|
minutes_to_confirm = config.MINIMUM_RESPONSE_TIME |
|
|
|
|
|
|
|
|
|
live_testing = getattr(settings, 'LIVE_TESTING', False) |
|
|
|
|
# Divide by 10 if LIVE_TESTING is enabled |
|
|
|
|
if live_testing: |
|
|
|
|
minutes_to_confirm = minutes_to_confirm / 10 |
|
|
|
|
|
|
|
|
|
# 8. Calculate raw deadline |
|
|
|
|
raw_deadline = current_time + timezone.timedelta(minutes=minutes_to_confirm) |
|
|
|
|
@ -1637,7 +1638,7 @@ class Tournament(BaseModel): |
|
|
|
|
|
|
|
|
|
# Set to business start hour |
|
|
|
|
raw_deadline = raw_deadline.replace( |
|
|
|
|
hour=BUSINESS_RULES["hours"]["default_confirmation_hour"], |
|
|
|
|
hour=business_start_hour, |
|
|
|
|
minute=0, |
|
|
|
|
second=0, |
|
|
|
|
microsecond=0 |
|
|
|
|
|