fix: scope eligible residents query to class facility (ID-686)#1161
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR modifies how the eligible residents query determines facility scope in ChangesClass-based facility filtering
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
carddev81
left a comment
There was a problem hiding this comment.
Tested Good and code looks great
Fix
Made the backend authoritative: changed the
WHEREclause inGetEligibleResidentsForClassto filter onc.facility_id(the class's own facility via the already-joinedprogram_classestable) instead ofargs.FacilityID.This holds regardless of caller role or what
facility_idis passed in the request.Files Changed
backend/src/database/users.goGetEligibleResidentsForClassbackend/tests/integration/class_enrollments_test.goTestEligibleResidentsFilteredByClassFacilitycovering:facility_id=BNot Changed
frontend/src/pages/class-detail/EnrollResidentsModal.tsxfacility_id=${classFacilityId}getQueryContextfacility logicTesting
Integration Test
facility_idManual Verification