-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PAE-845 Enhance prerequisites to allow more flexible configuration #59
base: pearson-release/juniper.stage
Are you sure you want to change the base?
Changes from 15 commits
afaef49
7fbd18d
7f5577a
fd1cb3d
06d1b0f
4c780d4
35df324
5eb6ccb
1ac789f
c3a4646
54599d5
878a61a
f8f73be
d92af02
abacb35
8abfea8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
|
@@ -802,8 +803,22 @@ def student_dashboard(request): | |||||
enrollment.course_id for enrollment in course_enrollments | ||||||
if enrollment.course_overview.pre_requisite_courses | ||||||
) | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary change. @anfbermudezme |
||||||
courses_requirements_not_met = get_pre_requisite_courses_not_completed(user, courses_having_prerequisites) | ||||||
|
||||||
# sort requirements for each course in course_requirements_not_met. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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 +880,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(), | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
|
@@ -956,6 +956,20 @@ def course_about(request, course_id): | |||||
# 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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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, | ||||||
) | ||||||
# the first prerequisite from courses_requirements_not_met is taken. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this explains what you are doing here. @anfbermudezme |
||||||
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 if course_requirements else None, | ||||||
Jacatove marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. course_requirements_for_courseware_views returns {} in case things don't go as expected, so you don't need to return None. @anfbermudezme |
||||||
'student_not_enrollment_in_requirement': \ | ||||||
skus_not_enrollment_in_requirements.get(course.id) if skus_not_enrollment_in_requirements else None, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sku_not_enrollment_in_requirements returns {} in case things don't go as expected, so you don't need to return None. @anfbermudezme |
||||||
"ecommerce_payment_page": EcommerceService().payment_page_url(), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this? @anfbermudezme There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
'course_image_urls': overview.image_urls, | ||||||
'reviews_fragment_view': reviews_fragment_view, | ||||||
'sidebar_html_enabled': sidebar_html_enabled, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.