Skip to content

Alert emails: show only what's due, color the PDF, per-type schedules - #62

Open
dannysusername wants to merge 1 commit into
mainfrom
newfeature
Open

dannysusername wants to merge 1 commit into
mainfrom
newfeature

Conversation

@dannysusername

Copy link
Copy Markdown
Owner

Summary

What's in the email (spec 013)

  • Lists only overdue and due-soon items (owner's lead times), most urgent first, [new] on items that got worse, then "The other N items are on track." The 39-line list of ok items is gone.
  • Sent as text + HTML (inline-styled template, dashboard pill colors, per-recipient stop link). Fleets: one section per aircraft with something due.
  • PDF Time Left is labeled OVERDUE (red) / DUE SOON (amber) using the owner's lead times, for alert, download and share PDFs.

When alerts send (spec 014)

  • Three alert emails, each Off / Once / every N days: Due soon (default 7), Overdue (default 3; the old "re-nudge" value carries over), Status report (default Off). Rules live in AlertSchedule (pure).
  • The daily check runs at the owner's hour in their time zone (sent by the browser), not the server's.
  • Bug fix: the email limit was a rolling 24 h, which dropped every other daily email (shown by a test: [0, 2, 4, 6, 8]). Now one per calendar day in the owner's zone.
  • Alerts read time from an injected Clock.

Migration: additive columns on alert_preferences (docs/migrations/2026-11-21_alert_schedules.sql); Hibernate adds them with defaults.

Tests

  • ./gradlew test: 366 passed. New: AlertScheduleTest (every rule), AlertSimulationTest (real scheduler over 10-60 simulated days, e.g. one item due day 25 → emails on days [0, 7, 14, 21, 26, 29, 32, 35, 38]), AlertTimeZoneTest, AlertPreferencesApiTest, AlertEmailRendererTest, NotificationServiceEmailTest, PdfExportColorsTest.
  • ./gradlew browserTest: 103 passed. New: AlertSettingsTest.

Not yet checked

  • A real alert email on staging (Gmail / Apple Mail).

🤖 Generated with Claude Code

Email content and look (spec 013)
- The alert email lists only overdue and due-soon items (owner's lead
  times), most urgent first, with "[new]" marks, then "The other N items
  are on track." No more 39 lines of "ok".
- Sent as text + HTML (inline-styled template, dashboard pill colors,
  per-recipient stop link). Fleets: one section per aircraft with
  something due.
- PDF Time Left is labeled OVERDUE (red) / DUE SOON (amber) using the
  owner's lead times, for alert, download and share PDFs.

When alerts send (spec 014)
- Three alert emails, each Off / Once / every N days: Due soon (default
  every 7 days), Overdue (every 3 days, was "re-nudge"; existing values
  carry over), Status report (Off). Rules live in AlertSchedule (pure).
- The daily check runs at the owner's hour in their own time zone (from
  the browser), not the server's.
- Fix: the email limit is one per calendar day in the owner's zone. The
  old rolling 24 hours dropped every other daily email.
- Alerts read time from an injected Clock; simulation tests run the real
  scheduler over 10-60 simulated days.

Tests: 366 unit, 103 browser, all passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant