Users are connected to shifts (or more accurately shift_events) though the shift_events_users table. When users are removed, it does not remove them from shift_events_users.
We use the absence of a user to determine if a shift need volunteers. Removing the user but not the shift_events_users record makes it appear like a user is absent and shift needs a volunteer, even when volunteers are assigned. See
.where(shift_events: {users: {id: nil}})
One fix could be to ensure the shift_events_users record is removed when the user or shift_event is also removed. We should probably do this one at least. Another fix could be to update the query to ignore any shifts that have a user assigned, as intended, not just check for any absent user.
Users are connected to shifts (or more accurately `shift_events`) though the `shift_events_users` table. When users are removed, it does not remove them from `shift_events_users`.
We use the absence of a user to determine if a shift need volunteers. Removing the user but not the `shift_events_users` record makes it appear like a user is absent and shift needs a volunteer, even when volunteers are assigned. See https://codeberg.org/rootable/tomato/src/commit/56a7d2bb/app/services/events_service/finder.rb#L124
One fix could be to ensure the `shift_events_users` record is removed when the `user` or `shift_event` is also removed. We should probably do this one at least. Another fix could be to update the query to ignore any shifts that have a user assigned, as intended, not just check for any absent user.