Repository navigation
Conversation
On the volunteer edit page, the "Assign a new case" dropdown groups cases into "Not Assigned" and "Assigned". A case that had been reassigned (an inactive assignment for the previous volunteer plus an active one for the current volunteer) showed up in both groups, and under "Not Assigned" its badge named the volunteer it is assigned to. CasaCase.not_assigned left joined case_assignments and kept rows where the assignment was missing or inactive. That condition is evaluated per assignment row, so a single inactive assignment was enough to return the case even though another assignment for it was still active. Return cases that have no active assignment instead, using a subquery on active case assignments. Cases that were never assigned, or whose assignments are all inactive, are still returned as before.
Anandb71
requested review from
FireLemons,
compwron and
elasticspoon
as code owners
November 10, 2026 14:17
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What github issue is this PR for, if any?
Resolves #7241
What changed, and why?
On the Edit Volunteer page, the "Assign a new case" dropdown listed a reassigned case under "Not Assigned" (with the currently assigned volunteer's name next to the case number) and again under "Assigned".
CasaCase.not_assignedleft joinedcase_assignmentsand kept rows where the assignment was missing or inactive. That condition is evaluated per assignment row, so a case with one inactive assignment (the previous volunteer) and one active assignment (the current volunteer) still matched through the inactive row.The scope now returns cases in the org that have no active assignment, using a subquery on active case assignments (
where.not(id: CaseAssignment.active.select(:casa_case_id))). Cases that were never assigned, or whose assignments are all inactive, are still returned, so a volunteer can still be re-assigned to a case they were unassigned from.not_assignedis only used byUiHelper#grouped_options_for_assigning_case.How is this tested? (please write rspec and jest tests!) 💖💪
spec/models/casa_case_spec.rb): a case with an inactive assignment and an active one is not returned by.not_assigned.spec/system/volunteers/edit_spec.rb, rack_test): on the Edit Volunteer page, a reassigned case is listed under "Assigned" and not under "Not Assigned".main(the system spec finds "REASSIGNED - User 4" under "Not Assigned") and pass with this change.spec/models/casa_case_spec.rb,spec/models/case_assignment_spec.rb,spec/helpers/ui_helper_spec.rb,spec/requests/case_assignments_spec.rbandspec/views/volunteers(118 examples, 0 failures), plus the non-JS examples inspec/system/volunteers/edit_spec.rb(34 examples, 0 failures).bundle exec standardrbon the changed files: no offenses.Screenshots please :)
The change is in the
not_assignedscope; the system spec above checks the dropdown groups directly. Happy to add screenshots if that would help review.