Skip to content

Pin cross-role waiting list promotion - #3000

Merged
mroderick merged 2 commits into
codebar:masterfrom
mroderick:test/waitlist-cross-role-promotion
Oct 9, 2026
Merged

mroderick merged 2 commits into
codebar:masterfrom
mroderick:test/waitlist-cross-role-promotion

Conversation

@mroderick

@mroderick mroderick commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Promotions filter by the cancelling invitation's role via WaitingList.where_role, but nothing pinned that — a change to next_spot could regress cross-role promotion silently. This PR adds the pin at both levels, against master's WaitingList.next_spot (the rename to promote_next happens in feat/post-close-rsvp-waitlist; the filtering rule carries over).

One of five small PRs from the same pre-existing-gap audit. Heads are reviewed independently; if a sibling merges first expect a trivial rebase.

Detail

Model level (spec/models/waiting_list_spec.rb): next_spot(workshop, 'Student') returns nil while only an older Coach entry is waitlisted; the entry survives untouched.

Controller level (spec/controllers/waiting_invitation_controller_spec.rb): a coach is waitlisted, a student seat frees up via reject — the coach invitation keeps attending nil and the waitlist is unchanged.

Review notes
  • Both specs are green on master — these pin current, intended behaviour, no fix involved.

Sibling PRs:

Promotion on reject filters by the cancelling invitation's role via
WaitingList.where_role, so an older entry for the other role must never
be promoted when a seat of one role frees up. Nothing pinned that.

Pin it on both levels: the model (next_spot returns nothing for a
Student seat while only an older Coach entry is waitlisted) and the
controller (a Coach waitlist entry's invitation keeps attending nil and
the waitlist is unchanged when a Student cancels).
@mroderick
mroderick force-pushed the test/waitlist-cross-role-promotion branch from ef287ff to a2e3773 Compare October 9, 2026 06:56
@mroderick
mroderick marked this pull request as ready for review October 9, 2026 07:00
@mroderick
mroderick merged commit a1bc2f9 into codebar:master Oct 9, 2026
10 checks passed
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