mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-09-30 06:43:12 +00:00
Fix weekend day shift active window to 8am-5pm
Before midnight-8am on weekends incorrectly reported the day shift as active when the previous night shift is still running.
This commit is contained in:
parent
745f8cd31e
commit
98631a3b2f
2 changed files with 2 additions and 2 deletions
|
|
@ -23,7 +23,7 @@ WEEKEND_DAYS = {"Saturday", "Sunday"}
|
|||
|
||||
def determine_shift_type(now: datetime) -> str:
|
||||
day_name = now.strftime("%A")
|
||||
if day_name in WEEKEND_DAYS and now.hour < 17:
|
||||
if day_name in WEEKEND_DAYS and 8 <= now.hour < 17:
|
||||
return "day"
|
||||
return "night"
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ def _is_active_shift_type(shift_type: str) -> bool:
|
|||
"""Check if the given shift type is the currently active one."""
|
||||
now = datetime.now(EASTERN)
|
||||
day_name = now.strftime("%A")
|
||||
if day_name in WEEKEND_DAYS and now.hour < 17:
|
||||
if day_name in WEEKEND_DAYS and 8 <= now.hour < 17:
|
||||
return shift_type == "day"
|
||||
return shift_type == "night"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue