Add cron container and per-household timezone for auto-reminders
CI / test-and-package (push) Successful in 36s

- docker-compose.yml: meal-cron service loops send_reminders_cron.py every 60s
- send_reminders_cron.py: checks each household's local time, sends ntfy
  reminders at 10:00 (lunch) and 16:00 (dinner), guarded against duplicates
- models.py: timezone, last_lunch_reminder, last_dinner_reminder on households
- meals.py: /admin/timezone route for admins to set household timezone
- dashboard: timezone selector (20 common zones) in Account Settings
- i18n: 5 new translation keys for timezone strings
- Dockerfile: copy send_reminders_cron.py
- tests: 4 new timezone tests (admin set, non-admin denied, default UTC, auth)
- docs: updated AGENTS.md
This commit is contained in:
agentbox
2026-08-01 06:23:33 +00:00
parent 3681f9dfce
commit 2cd435daf2
9 changed files with 248 additions and 2 deletions
+24
View File
@@ -25,6 +25,8 @@ from models import (
set_user_ntfy,
get_user_ntfy,
get_user_by_callback_token,
set_household_timezone,
get_household_by_id,
)
from i18n import t
from ntfy import send_test_notification
@@ -73,6 +75,7 @@ def dashboard():
data = get_dashboard_data(today, household_id)
ntfy = get_user_ntfy(session["user_id"])
household = get_household_by_id(household_id)
return render_template(
"dashboard.html",
dashboard=data,
@@ -83,6 +86,7 @@ def dashboard():
current_user_id=session["user_id"],
is_admin=session["is_admin"],
ntfy=ntfy,
household=household,
)
@@ -132,6 +136,7 @@ def history():
data = get_dashboard_data(target_date, session["household_id"])
ntfy = get_user_ntfy(session["user_id"])
household = get_household_by_id(session["household_id"])
return render_template(
"dashboard.html",
dashboard=data,
@@ -143,6 +148,7 @@ def history():
is_admin=session["is_admin"],
history_mode=True,
ntfy=ntfy,
household=household,
)
@@ -221,6 +227,24 @@ def admin_delete_household():
return redirect(url_for("auth.login"))
@meals_bp.route("/admin/timezone", methods=["POST"])
@login_required
def admin_set_timezone():
"""Admin sets the household timezone."""
if not session["is_admin"]:
flash(t("Only admins can change the timezone."), "error")
return redirect(url_for("meals.dashboard"))
timezone = request.form.get("timezone", "").strip()
if not timezone:
flash(t("Please select a timezone."), "error")
return redirect(url_for("meals.dashboard"))
set_household_timezone(session["household_id"], timezone)
flash(t("Timezone updated."), "success")
return redirect(url_for("meals.dashboard"))
# ── Ntfy integration ─────────────────────────────────────────────────────────
@meals_bp.route("/ntfy-settings", methods=["POST"])