diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 608a7372a06c..6aa153ca3f05 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -1161,6 +1161,13 @@ 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) + # Add all courses with same org and number to milestones + 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[PREREQUISITE_NOT_MET]), + ) else: # None is chosen, so remove the course prerequisites course_milestones = milestones_api.get_course_milestones(course_key=course_key, relationship="requires") diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index af8a5fc5ecd4..c035a4ff8407 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -45,6 +45,7 @@ from openedx.core.djangoapps.waffle_utils import WaffleFlag, WaffleFlagNamespace from openedx.core.djangolib.markup import HTML, Text from openedx.features.enterprise_support.api import get_dashboard_consent_notification +from openedx.core.djangoapps.plugins.plugins_hooks import run_extension_point from shoppingcart.models import CourseRegistrationCode, DonationConfiguration from student.api import COURSE_DASHBOARD_PLUGIN_VIEW_NAME from student.helpers import cert_info, check_verify_status_by_course, get_resume_urls_for_enrollments @@ -804,6 +805,19 @@ def student_dashboard(request): ) courses_requirements_not_met = get_pre_requisite_courses_not_completed(user, courses_having_prerequisites) + # Sort requirements for each course in course_requirements_not_met + courses_requirements_not_met = run_extension_point( + 'PEARSON_CORE_SORT_ENROLLED_PREREQUISITES', + user=user, + courses_requirements_not_met=courses_requirements_not_met, + ) + # Get the SKU value for the requirements of each course in courses_requirements_not_met + skus_not_enrollment_in_requirements = run_extension_point( + 'PEARSON_CORE_STUDENT_NOT_ENROLLED_IN_REQUIREMENTS', + user=user, + courses_requirements_not_met=courses_requirements_not_met, + ) + if 'notlive' in request.GET: redirect_message = _("The course you are looking for does not start until {date}.").format( date=request.GET['notlive'] @@ -865,6 +879,7 @@ def student_dashboard(request): 'enrolled_courses_either_paid': enrolled_courses_either_paid, 'provider_states': [], 'courses_requirements_not_met': courses_requirements_not_met, + 'sku_not_enrollment_in_requirement': skus_not_enrollment_in_requirements, 'nav_hidden': True, 'inverted_programs': inverted_programs, 'show_program_listing': ProgramsApiConfig.is_enabled(), diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 407a105b5cdc..b062a0232d15 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -125,7 +125,7 @@ from track import segment from util.cache import cache, cache_if_anonymous from util.db import outer_atomic -from util.milestones_helpers import get_prerequisite_courses_display +from util.milestones_helpers import get_prerequisite_courses_display, get_pre_requisite_courses_not_completed from util.views import ensure_valid_course_key, ensure_valid_usage_key from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE from xmodule.modulestore.django import modulestore @@ -953,9 +953,23 @@ def course_about(request, course_id): is_shib_course = uses_shib(course) - # get prerequisite courses display names + # Get prerequisite courses display names pre_requisite_courses = get_prerequisite_courses_display(course) + courses_requirements_not_met = get_pre_requisite_courses_not_completed(request.user, frozenset({course.id})) + # Sort requirements for each course in course_requirements_not_met + skus_not_enrollment_in_requirements = run_extension_point( + 'PEARSON_CORE_STUDENT_NOT_ENROLLED_IN_REQUIREMENTS', + user=request.user, + courses_requirements_not_met=courses_requirements_not_met, + ) + # Dictionary with the first requirement in course_requirements_not_met + 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 overview = CourseOverview.get_from_id(course.id) @@ -994,6 +1008,10 @@ def course_about(request, course_id): # context. This value is therefor explicitly set to render the appropriate header. 'disable_courseware_header': True, 'pre_requisite_courses': pre_requisite_courses, + 'course_requirements': course_requirements, + 'student_not_enrollment_in_requirement': \ + skus_not_enrollment_in_requirements.get(course.id), + "ecommerce_payment_page": EcommerceService().payment_page_url(), 'course_image_urls': overview.image_urls, 'reviews_fragment_view': reviews_fragment_view, 'sidebar_html_enabled': sidebar_html_enabled,