Closed brandonc closed 7 years ago
Rebased and added a unit test for this query. To answer your question-- an assignment
is the many-to-many record that relates volunteers to regions.
Not confusing at all! I'd say an assignment is a shift! shakes head
~Hang on somehow I may have broken features/shifts_needing_coverage_spec.rb~ nope it works
It's not very nice to call the volunteers shiftless, just because they don't have an assignment ;)
They are adrift in the world, Sean!
Overview
Addresses #130 -- Previously, the shiftless volunteers route was loading all volunteers into memory and performing n2+1 database queries to figure out which ones in the shared regions have no shifts assigned. This was translated into equivalent SQL
Details
I thought a count subquery was simpler than an equivalent left join / group / having
Notes
There remains the question as to whether
current_volunteer.region_ids
is a decent criteria for finding shiftless volunteers. Another option might becurrent_volunteer.admin_region_ids
?