Skip to content

fix: require course run for late custom enrollments#184

Open
zwidekalanga wants to merge 4 commits into
mainfrom
cnx/late-enrollment-custom-presentations
Open

fix: require course run for late custom enrollments#184
zwidekalanga wants to merge 4 commits into
mainfrom
cnx/late-enrollment-custom-presentations

Conversation

@zwidekalanga

Copy link
Copy Markdown
Contributor

Description:
Late enrollment was still depending on course-level metadata resolving to an advertised or future run. That blocks custom/one-off presentations where the intended run is already past and no future cohort exists.

This PR makes the assignment path fail early with an actionable error when a course key does not resolve to a concrete course run, and updates operator-facing guidance to use exact course run keys for custom late enrollments. It also keeps the forced-redemption assignment path covered so the requested run remains the assignment's preferred run.

What changed

  • Require assignment metadata to include a resolved course_run_key before creating/updating assignments.
  • Return the exact error text to API callers instead of the generic allocation message.
  • Clarify allocation API/admin help text for custom one-off presentations.
  • Add the investigation and implementation plan in docs/late-enrollment-custom-presentations-plan.md.

Related PRs

Testing

  • pytest enterprise_access/apps/content_assignments/tests/test_api.py::TestAssignmentAllocationAndCancellation::test_allocate_assignments_requires_resolved_course_run enterprise_access/apps/subsidy_access_policy/tests/test_forced_redemption.py::ForcedPolicyRedemptionAssignmentTests::test_force_redemption_with_assignment_happy_path
  • python -m py_compile enterprise_access/apps/content_assignments/api.py enterprise_access/apps/api/serializers/subsidy_access_policy.py enterprise_access/apps/content_assignments/tests/test_api.py enterprise_access/apps/subsidy_access_policy/tests/test_forced_redemption.py
  • git diff --check

Jira:
ENT-XXXX

Merge checklist:

  • ./manage.py makemigrations was not required; no model fields were changed.

Post merge:

  • Ensure that your changes went out to the stage instance
  • Deploy to prod instance

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.13%. Comparing base (409cec2) to head (b27e27a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #184   +/-   ##
=======================================
  Coverage   86.13%   86.13%           
=======================================
  Files         151      151           
  Lines       12547    12554    +7     
  Branches     1197     1198    +1     
=======================================
+ Hits        10807    10814    +7     
  Misses       1425     1425           
  Partials      315      315           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant