fix scheduler orario start, immagine parcheggio, added more logs function

This commit is contained in:
2026-02-12 19:57:00 +01:00
parent a94ec11c80
commit 8f5c1e1f94
12 changed files with 192 additions and 24 deletions

View File

@@ -228,7 +228,10 @@ def send_daily_parking_reminder(user: "User", date_obj: datetime, db: "Session")
from database.models import DailyParkingAssignment, NotificationLog
from services.parking import get_spot_display_name
config.logger.info(f"[SCHEDULER] Checking daily parking reminder for user {user.email}")
if not user.notify_daily_parking:
config.logger.debug(f"[SCHEDULER] User {user.email} has disabled daily parking notifications")
return False
date_str = date_obj.strftime("%Y-%m-%d")
@@ -308,10 +311,10 @@ def run_scheduled_notifications(db: "Session"):
users = db.query(User).all()
for user in users:
# Thursday at 12: Presence reminder
if current_weekday == 3 and current_hour == 12 and current_minute < 5:
next_week = get_next_week_dates(today_date)
send_presence_reminder(user, next_week, db)
# Thursday Reminder: DISABLED as per user request
# if current_weekday == 3 and current_hour == 12 and current_minute < 5:
# next_week = get_next_week_dates(today_date)
# send_presence_reminder(user, next_week, db)
# Daily parking reminder at user's preferred time
user_hour = user.notify_daily_parking_hour or 8
@@ -319,6 +322,7 @@ def run_scheduled_notifications(db: "Session"):
# Check if it's the right time for this user
if current_hour == user_hour and abs(current_minute - user_minute) < 5:
config.logger.info(f"[SCHEDULER] Triggering Daily Parking Reminder check for user {user.email} (Scheduled: {user_hour}:{user_minute})")
# Check if Office is OPEN today
is_office_open = True