Skip to content

Commit

Permalink
feat: add more verbose logging around force_enrollment
Browse files Browse the repository at this point in the history
After testing the enterprise bulk enrollment flow with
force_enrollment=True, I'm finding that the enrollment is still not
forced. This extra logging will hopefully help shed light on where this
boolean might be accidentally ignored.
  • Loading branch information
pwnage101 committed Apr 15, 2024
1 parent 0270809 commit f30ae71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions common/djangoapps/student/models/course_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,10 @@ def enroll(cls, user, course_key, mode=None, check_access=False, can_upgrade=Fal
if check_access:
if cls.is_enrollment_closed(user, course) and not can_upgrade:
log.warning(
"User %s failed to enroll in course %s because enrollment is closed",
"User %s failed to enroll in course %s because enrollment is closed (can_upgrade=%s).",
user.username,
str(course_key)
str(course_key),
can_upgrade,
)
raise EnrollmentClosedError

Expand Down
3 changes: 2 additions & 1 deletion openedx/features/enterprise_support/enrollments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ def lms_update_or_create_enrollment(
except (CourseEnrollmentError, CourseEnrollmentNotUpdatableError) as error:
log.exception(
"Raising error [%s] for user "
"[%s]: course run = [%s], enterprise_uuid = [%s], is_active = [%s], ",
"[%s]: course run = [%s], enterprise_uuid = [%s], is_active = [%s], force_enrollment = [%s], ",
error,
username,
course_id,
str(enterprise_uuid),
is_active,
force_enrollment,
)
raise error
finally:
Expand Down

0 comments on commit f30ae71

Please sign in to comment.