Fix off-day med reminders and add medication editing
Scheduler: check_nagging() now calls _is_med_due_today() before creating on-demand schedules or processing existing ones — prevents nagging for specific_days / every_n_days meds on days they are not scheduled. Web client: add Edit button (pencil icon) on each medication card linking to /dashboard/medications/[id]/edit — new page pre-populates the full form (name, dosage, unit, frequency, times, days, interval, notes) and submits PUT /api/medications/:id on save. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -317,6 +317,10 @@ def check_nagging():
|
||||
now = _user_now_for(user_uuid)
|
||||
today = now.date()
|
||||
|
||||
# Skip nagging if medication is not due today
|
||||
if not _is_med_due_today(med, today):
|
||||
continue
|
||||
|
||||
# Get today's schedules
|
||||
try:
|
||||
schedules = postgres.select(
|
||||
@@ -333,8 +337,10 @@ def check_nagging():
|
||||
# Table may not exist yet
|
||||
continue
|
||||
|
||||
# If no schedules exist, try to create them
|
||||
# If no schedules exist, try to create them — but only if med is due today
|
||||
if not schedules:
|
||||
if not _is_med_due_today(med, today):
|
||||
continue
|
||||
logger.info(f"No schedules found for medication {med_id}, attempting to create")
|
||||
times = med.get("times", [])
|
||||
if times:
|
||||
|
||||
Reference in New Issue
Block a user