Add fallback to original medication reminders when adaptive tables don't exist

This commit is contained in:
2026-02-16 21:02:34 -06:00
parent 6e875186b4
commit f740fe8be2

View File

@@ -399,13 +399,26 @@ def poll_callback():
# Create daily schedules at midnight
now = datetime.utcnow()
if now.hour == 0 and now.minute < POLL_INTERVAL / 60:
create_daily_adaptive_schedules()
try:
create_daily_adaptive_schedules()
except Exception as e:
logger.warning(
f"Could not create adaptive schedules (tables may not exist): {e}"
)
# Check reminders with adaptive timing
check_adaptive_medication_reminders()
# Check reminders - try adaptive first, fall back to original
try:
check_adaptive_medication_reminders()
except Exception as e:
logger.warning(f"Adaptive medication check failed, using fallback: {e}")
# Fall back to original medication check
check_medication_reminders()
# Check for nags
check_nagging()
try:
check_nagging()
except Exception as e:
logger.warning(f"Nagging check failed: {e}")
# Original checks
check_routine_reminders()