Skip to content

Commit

Permalink
Merge pull request #1825 from openedx/ea/ent-7453
Browse files Browse the repository at this point in the history
* chore: use lms_update_or_create_enrollment without feature flag
  • Loading branch information
emrosarioa authored Sep 21, 2023
2 parents 0bdbfbf + cfc757c commit 9c10106
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 519 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Change Log
Unreleased
----------
[4.3.1]
--------
chore: use lms_update_or_create_enrollment without feature flag

[4.3.0]
--------
feat: Added the ``enable_career_engagement_network_on_learner_portal`` field for EnterpriseCustomer
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__ = "4.3.0"
__version__ = "4.3.1"
34 changes: 8 additions & 26 deletions enterprise/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@
from enterprise.logging import getEnterpriseLogger

try:
from openedx.features.enterprise_support.enrollments.utils import (
lms_enroll_user_in_course,
lms_update_or_create_enrollment,
)
from openedx.features.enterprise_support.enrollments.utils import lms_update_or_create_enrollment
except ImportError:
lms_enroll_user_in_course = None
lms_update_or_create_enrollment = None

try:
Expand Down Expand Up @@ -1824,30 +1820,16 @@ def customer_admin_enroll_user_with_status(
succeeded = False
new_enrollment = False
enterprise_fulfillment_source_uuid = None
emet_enable_auto_upgrade_enrollment_mode = getattr(
settings,
'ENABLE_ENTERPRISE_BACKEND_EMET_AUTO_UPGRADE_ENROLLMENT_MODE',
False,
)
try:
# enrolls a user in a course per LMS flow, but this method doesn't create enterprise records
# yet so we need to create it immediately after calling lms_update_or_create_enrollment.
if emet_enable_auto_upgrade_enrollment_mode:
new_enrollment = lms_update_or_create_enrollment(
user.username,
course_id,
course_mode,
is_active=True,
enterprise_uuid=enterprise_customer.uuid,
)
else:
new_enrollment = lms_enroll_user_in_course(
user.username,
course_id,
course_mode,
enterprise_customer.uuid,
is_active=True,
)
new_enrollment = lms_update_or_create_enrollment(
user.username,
course_id,
course_mode,
is_active=True,
enterprise_uuid=enterprise_customer.uuid,
)
succeeded = True
LOGGER.info("Successfully enrolled user %s in course %s", user.id, course_id)
except (CourseEnrollmentError, CourseUserGroup.DoesNotExist) as error:
Expand Down
Loading

0 comments on commit 9c10106

Please sign in to comment.