diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 384ee791d..2666702d9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,11 @@ Unreleased ---------- * nothing unreleased +[5.3.1] +------- +* fix: rely on single constant to define course mode priority order (i.e., ensure all enrollable modes are considered; previously missing honor mode in `enroll_learners_in_courses`). +* fix: prevent fetching catalog list without a resolved course run in the property `applicable_enterprise_catalog_uuids` within `DefaultEnterpriseEnrollmentIntention`. + [5.3.0] -------- * refactor: Removed unused django setting. diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 504cc10c3..f76324143 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "5.3.0" +__version__ = "5.3.1" diff --git a/enterprise/constants.py b/enterprise/constants.py index 127627303..cc0f8378f 100644 --- a/enterprise/constants.py +++ b/enterprise/constants.py @@ -59,14 +59,6 @@ class CourseModes: VERIFIED = 'verified' UNPAID_EXECUTIVE_EDUCATION = 'unpaid-executive-education' - -BEST_MODE_ORDER = [ - CourseModes.VERIFIED, - CourseModes.PROFESSIONAL, - CourseModes.NO_ID_PROFESSIONAL, - CourseModes.UNPAID_EXECUTIVE_EDUCATION, -] - # Course mode sorting based on slug COURSE_MODE_SORT_ORDER = [ CourseModes.VERIFIED, diff --git a/enterprise/models.py b/enterprise/models.py index f76655795..6e559fc63 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -2630,6 +2630,10 @@ def applicable_enterprise_catalog_uuids(self): """ Returns a list of UUIDs for applicable enterprise catalogs. """ + if not self.course_run_key: + # Without a resolved course run key, prevent the enterprise catalog list from being fetched. + return [] + contains_content_items_response = get_and_cache_enterprise_contains_content_items( enterprise_customer_uuid=self.enterprise_customer.uuid, content_keys=[self.course_run_key], diff --git a/enterprise/utils.py b/enterprise/utils.py index 07370c950..b04bc43be 100644 --- a/enterprise/utils.py +++ b/enterprise/utils.py @@ -37,7 +37,7 @@ from enterprise.constants import ( ALLOWED_TAGS, - BEST_MODE_ORDER, + COURSE_MODE_SORT_ORDER, DEFAULT_CATALOG_CONTENT_FILTER, LMS_API_DATETIME_FORMAT, LMS_API_DATETIME_FORMAT_WITHOUT_TIMEZONE, @@ -2404,7 +2404,7 @@ def get_best_mode_from_course_key(course_key): enterprise learner in. """ course_modes = [mode.slug for mode in CourseMode.objects.filter(course_id=course_key)] - if best_mode := [mode for mode in BEST_MODE_ORDER if mode in course_modes]: + if best_mode := [mode for mode in COURSE_MODE_SORT_ORDER if mode in course_modes]: return best_mode[0] return CourseModes.AUDIT