Skip to content

Commit e510363

Browse files
tobiascadeeCopilot
andauthored
Update webapp/ordering/core.py
Co-authored-by: Copilot <[email protected]>
1 parent 4780cf5 commit e510363

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

webapp/ordering/core.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,8 @@ def create_orderround_batch():
271271
return []
272272

273273
# Adjust start date to the configured open day of the week
274-
if start_date.weekday() < config.ORDERROUND_OPEN_DAY_OF_WEEK: # Ensure it starts on the configured day
275-
start_date += timedelta(days=config.ORDERROUND_OPEN_DAY_OF_WEEK - start_date.weekday())
276-
elif start_date.weekday() > config.ORDERROUND_OPEN_DAY_OF_WEEK:
277-
start_date -= timedelta(days=start_date.weekday() - config.ORDERROUND_OPEN_DAY_OF_WEEK)
278-
274+
days_until_target = (config.ORDERROUND_OPEN_DAY_OF_WEEK - start_date.weekday()) % 7
275+
start_date += timedelta(days=days_until_target)
279276
# Calculate the end date for the next quarter
280277
# This will be the last day of the next quarter
281278
end_date = get_last_day_of_next_quarter()

0 commit comments

Comments
 (0)