chore: refactor LCR bulk actions to align with Content Assignments#100
Conversation
1e522eb to
50f15dd
Compare
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (79.71%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
==========================================
+ Coverage 84.01% 84.20% +0.18%
==========================================
Files 144 144
Lines 12226 12128 -98
Branches 1170 1155 -15
==========================================
- Hits 10272 10212 -60
+ Misses 1625 1596 -29
+ Partials 329 320 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e2b4511 to
25ee164
Compare
25ee164 to
e05df3e
Compare
There was a problem hiding this comment.
Pull request overview
Refactors Learner Credit Request (LCR) bulk action behavior to mirror Content Assignments patterns, centralizing bulk logic in subsidy_request.api and updating the B&R v1 endpoints/serializers accordingly.
Changes:
- Added state-group constants (
APPROVABLE_STATES,DECLINABLE_STATES,REMINDABLE_STATES) and updated API/view filtering to use them. - Introduced
decline_learner_credit_requestsAPI and refactored remind/decline flows to use bulk action/audit creation patterns. - Updated DRF serializers/endpoints and expanded/adjusted test coverage for the new decline-all and API-layer behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| enterprise_access/apps/subsidy_request/tests/test_api.py | Adds API-layer tests for approve/remind/cancel/decline bulk behaviors. |
| enterprise_access/apps/subsidy_request/models.py | Removes unused bulk approve helper; keeps bulk decline behavior in model. |
| enterprise_access/apps/subsidy_request/constants.py | Adds state-group constants to standardize bulk operation filtering. |
| enterprise_access/apps/subsidy_request/api.py | Refactors bulk approve/remind and adds bulk decline API with audit/task behavior. |
| enterprise_access/apps/api/v1/views/browse_and_request.py | Updates LCR endpoints: approve-all response body, decline (single) refactor, adds decline-all. |
| enterprise_access/apps/api/v1/tests/test_browse_and_request_views.py | Updates view tests to match new decline-all/decline behaviors and routes. |
| enterprise_access/apps/api/serializers/subsidy_requests.py | Adds decline-all serializer; makes remind require UUID list (removes legacy single UUID support). |
| enterprise_access/apps/api/serializers/init.py | Exposes new serializer; removes bulk approve/decline serializers. |
Comments suppressed due to low confidence (1)
enterprise_access/apps/subsidy_request/api.py:54
approve_learner_credit_requestsreturns{"approved": [], "failed": ...}when there are no approvable requests (line 53), but returnsfailed_approvalin the normal path (line 122). This inconsistent contract can cause callers to silently miss failures (e.g., views that only readfailed_approval). Consider standardizing on a single key (e.g., alwaysfailed_approval) across all return paths and updating callers/tests accordingly.
requests_to_process = [
req for req in learner_credit_requests
if req.state in APPROVABLE_STATES
]
if not requests_to_process:
return {"approved": [], "failed": list(learner_credit_requests)}
iloveagent57
left a comment
There was a problem hiding this comment.
approved to unblock, but this change is worth making: #100 (comment)
34da27c to
387c4c4
Compare
387c4c4 to
d958f33
Compare
Description:
Refactor LCR bulk actions to align with Content Assignments as bulk action in frontend should behave identically.
Jira:
ENT-11480
Merge checklist:
./manage.py makemigrationshas been runPost merge: