Venus / src /services /scheduler_service.py
Amir
Venus Hotel Front Desk – initial HF deploy
9d9d2a1
raw
history blame contribute delete
654 Bytes
from src.db.connection import get_conn
from src.db.closing import is_closed
from src.utils.time_utils import muscat_now, should_auto_close, business_day_for_close
from src.services.closing_service import close_day
def auto_close_if_needed(db_path: str, actor: str, note: str) -> None:
now = muscat_now()
if not should_auto_close(now):
return
business_date = business_day_for_close(now)
conn = get_conn(db_path)
try:
if is_closed(conn, business_date):
return
finally:
conn.close()
# Perform closing
close_day(db_path=db_path, business_date=business_date, closed_by=actor, note=note)