5
11
Fork
You've already forked tomato
1

User-shift connections remain when the user is deleted #38

Open
opened 2025年10月22日 15:15:26 +02:00 by edwardloveall · 0 comments

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.
Sign in to join this conversation.
No Branch/Tag specified
main
el-tracker-receipts
el-edit-tracker
el-exclude-tracker-site-receipt
el-trackers
el-occurrence-view
el-fix-shift-filter-time-zone
bb-reports
No results found.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato#38
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?