From f8f73be36b14f46743e8af945a112faf83cc6b65 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 1 Feb 2022 13:24:17 -0500 Subject: [PATCH] refactor: add entry for run_extension_point in course_about view and remove magic number un course.py. --- cms/djangoapps/contentstore/views/course.py | 3 ++- lms/djangoapps/courseware/views/views.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 3d9757892196..0aa0709f22d1 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -1161,10 +1161,11 @@ def settings_handler(request, course_key_string): if not all(is_valid_course_key(course_key) for course_key in prerequisite_course_keys): return JsonResponseBadRequest({"error": _("Invalid prerequisite course key")}) set_prerequisite_courses(course_key, prerequisite_course_keys) + PREREQUISITE_NOT_MET = 0 run_extension_point( 'PEARSON_CORE_MILESTONE_PREREQUISITES_MODULE', course_key=course_key, - prerequisite_course_key=CourseKey.from_string(prerequisite_course_keys[0]) + prerequisite_course_key=CourseKey.from_string(prerequisite_course_keys[PREREQUISITE_NOT_MET]), ) else: # None is chosen, so remove the course prerequisites diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index f821db642ea4..f93e2069612d 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -965,6 +965,7 @@ def course_about(request, course_id): course_requirements = run_extension_point( 'PEARSON_CORE_STUDENT_COURSE_REQUIREMENTS_FOR_COURSEWARE', courses_requirements_not_met=courses_requirements_not_met, + course_locator=course.id, ) # Overview