Skip to content

Commit

Permalink
fix: unenrolled default intentions not realizable
Browse files Browse the repository at this point in the history
The default enrollment ``learner_status`` view now considers intended courses from which the requested user has unenrolled as no-longer realizable.
ENT-9839
  • Loading branch information
iloveagent57 committed Dec 10, 2024
1 parent 7ca0731 commit 1ed53c2
Show file tree
Hide file tree
Showing 5 changed files with 761 additions and 694 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Unreleased
----------
* nothing unreleased

[5.4.1]
--------
* fix: The default enrollment ``learner_status`` view now considers intended courses
from which the requested user has unenrolled as no-longer realizable.

[5.4.0]
--------
* chore: Update python requirements.
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "5.4.0"
__version__ = "5.4.1"
11 changes: 11 additions & 0 deletions enterprise/api/v1/views/default_enterprise_enrollments.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,17 @@ def _partition_default_enrollment_intentions_by_enrollment_status(
already_enrolled.append((intention, non_audit_enrollment))
continue

if non_audit_enrollment and non_audit_enrollment.unenrolled:
# Learner has un-enrolled in non-audit mode for this course run,
# so don't consider this as an enrollable intention.
# Note that that we don't consider the case of an unenrolled *audit* enrollment,
# because default enrollments should be "exactly once" per (user, enterprise), if possible.
# If only an (unenrolled) audit enrollment exists, it means the user likely
# never had a default intention realized for them in the given course,
# so we'd still like to consider it as enrollable.
needs_enrollment_not_enrollable.append((intention, non_audit_enrollment))
continue

if not intention.is_course_run_enrollable:
# Course run is not enrollable
needs_enrollment_not_enrollable.append((intention, audit_enrollment))
Expand Down
Loading

0 comments on commit 1ed53c2

Please sign in to comment.