Skip to content

fix: point weekly update notifications at the right week, and honour Senate type preferences (#91, #92, #93) - #97

Merged
pataniaeli merged 2 commits into
devfrom
fix/issue-91-93-weekly-notifications
Sep 9, 2026
Merged

fix: point weekly update notifications at the right week, and honour Senate type preferences (#91, #92, #93)#97
pataniaeli merged 2 commits into
devfrom
fix/issue-91-93-weekly-notifications

Conversation

@pataniaeli

Copy link
Copy Markdown
Collaborator

Closes #91. Closes #92. Closes #93.

Three bugs in the same path — what Chambers sends when a weekly booking is edited, and who it sends it to.

#91 — update emails and alerts pointed at the wrong week

The weekly PATCH picked the session to describe with "the first occurrence carrying any override". That is a different question from "which week did this edit move", and usually a different week: an override set on week 1 months ago is still an override today, so every later edit to a series was reported against week 1 — with an empty "What changed" table, because week 1 had not in fact moved. That is exactly the email in #91: an edit to 9/29 reported as week 1 of 13, Sept 15, with no change list.

Occurrences are deleted and reinserted on every save, so the answer has to come from a comparison against the rows that were there before. lib/weekly-occurrences.ts does that, normalising the shapes Postgres and the editor disagree about (18:30:00 vs 18:30, null vs '') so a value that only changed form is not read as a change.

The weekly editor saves every week at once, so one save can move several. Naming only the first meant the rest changed silently, so the email now describes every week that moved. One week reads exactly as it does today; several get a block each.

#92, #93 — Senate type preferences were client-only

The preference existed only inside the My Rooms list filter, so deselecting Office Hours hid those sessions from the page and did nothing else. The rule and the type list (declared twice) now live in lib/senate-types.ts, and resolveBookingRecipients applies it to the audience it returns — so the page, the emails and the alerts cannot drift apart.

One wanted session in a batch is enough to keep someone in the audience: a save that moved both a Full Body week and an Office Hours week still emails someone who follows only Full Body. The filter applies to Leadership too — the preference is about what someone reads, not what they are responsible for.

The Settings label, which promised this only affected My Rooms, now says what it actually does.

Verification

tsc and eslint are clean (the 20 pre-existing lint problems elsewhere in app/ are unchanged). The occurrence diff and the preference rule were exercised directly — 15 and 13 cases respectively, including the #91 scenario and the #92 one. The three email shapes were rendered and read.

I could not verify the Settings panel or My Rooms in a browser: the dev server is behind a login wall.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
chambers Ready Ready Preview Sep 9, 2026 10:40pm UTC

pataniaeli and others added 2 commits September 9, 2026 18:39
The weekly PATCH picked the session to describe with "the first
occurrence carrying any override". That is a different question from
"which week did this edit move", and usually a different week: an
override set on week 1 months ago is still an override today, so every
later edit to a series was reported against week 1 -- with an empty
"What changed" table, because week 1 had not in fact moved.

Occurrences are deleted and reinserted on every save, so the answer has
to come from a comparison against the rows that were there before.
lib/weekly-occurrences.ts does that, normalising the shapes Postgres and
the editor disagree about (18:30:00 vs 18:30, null vs '') so a value that
only changed form is not read as a change. is_event is compared as a
plain boolean rather than an override, since an absent value there means
"not an event" and not "inherit".

The user_alerts rows now point at the earliest week that moved, and the
email describes every week that moved rather than one of them -- the
weekly editor saves all weeks at once, so a single save can move several,
and naming only the first meant the rest changed silently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…93)

The preference existed only on the client, inside the My Rooms list
filter, so deselecting Office Hours hid those sessions from the page and
did nothing else. Update emails and dashboard alerts still went to every
member of the Senate, including the people who had said they did not want
them.

The rule -- and the list of session types, which was declared twice --
now live in lib/senate-types.ts, and resolveBookingRecipients applies it
to the audience it returns, so the page, the emails and the alerts cannot
drift apart. The weekly PATCH tells it which sessions the notification is
about: the weeks that moved, or all of them when the series itself moved.

One wanted session in a batch is enough to keep a member in the audience.
Someone who follows Full Body but not Office Hours still needs the email
about a save that moved both -- suppressing it would lose a session they
asked to know about, which is the worse failure of the two.

The filter applies to Leadership as well. The preference is about what
someone reads, not what they are responsible for, and Leadership can
still see every session on the booking itself.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pataniaeli
pataniaeli force-pushed the fix/issue-91-93-weekly-notifications branch from e61542f to 58667eb Compare September 9, 2026 22:39
@pataniaeli pataniaeli self-assigned this Sep 9, 2026
@pataniaeli pataniaeli added the bug Something isn't working label Sep 9, 2026
@pataniaeli
pataniaeli merged commit 44bccb9 into dev Sep 9, 2026
4 checks passed
@pataniaeli
pataniaeli deleted the fix/issue-91-93-weekly-notifications branch September 9, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

1 participant