From e25e17ee88973f68c4d9ad1958c6452a0d97c9ae Mon Sep 17 00:00:00 2001 From: julianajlk Date: Tue, 24 May 2022 10:24:38 -0400 Subject: [PATCH] fix: Use dashboard_index to get FBE status (#30463) REV-2466 --- common/djangoapps/student/views/dashboard.py | 6 +-- lms/templates/dashboard.html | 2 +- .../dashboard/_dashboard_course_listing.html | 46 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 85305e25ff8c..37d8c645c57a 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -764,7 +764,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem show_account_activation_popup = request.COOKIES.get(settings.SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME, None) - fbe_status_list = [] + enrollments_fbe_is_on = [] for enrollment in course_enrollments: course_key = CourseKey.from_string(str(enrollment.course_id)) gated_content = ContentTypeGatingConfig.enabled_for_enrollment( @@ -774,7 +774,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem duration = get_user_course_duration(enrollment.user, enrollment.course) deadline = duration and get_user_course_expiration_date(request.user, enrollment.course) fbe_is_on = bool(deadline and gated_content) - fbe_status_list.append(fbe_is_on) + enrollments_fbe_is_on.append(fbe_is_on) context = { 'urls': urls, @@ -822,7 +822,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem 'display_sidebar_account_activation_message': not(user.is_active or hide_dashboard_courses_until_activated), 'display_dashboard_courses': (user.is_active or not hide_dashboard_courses_until_activated), 'empty_dashboard_message': empty_dashboard_message, - 'fbe_status_list': fbe_status_list, + 'enrollments_fbe_is_on': enrollments_fbe_is_on, 'recovery_email_message': recovery_email_message, 'recovery_email_activation_message': recovery_email_activation_message, 'show_load_all_courses_link': show_load_all_courses_link(user, course_limit, course_enrollments), diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 2bebd24dc340..34358488f9a0 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -224,7 +224,7 @@ show_consent_link = (session_id in consent_required_courses) resume_button_url = resume_button_urls[dashboard_index] %> - <%include file='dashboard/_dashboard_course_listing.html' args='course_overview=course_overview, course_card_index=dashboard_index, enrollment=enrollment, fbe_status_list=fbe_status_list, is_unfulfilled_entitlement=is_unfulfilled_entitlement, is_fulfilled_entitlement=is_fulfilled_entitlement, entitlement=entitlement, entitlement_session=entitlement_session, entitlement_available_sessions=entitlement_available_sessions, entitlement_expiration_date=entitlement_expiration_date, entitlement_expired_at=entitlement_expired_at, show_courseware_link=show_courseware_link, cert_status=cert_status, can_refund_entitlement=can_refund_entitlement, can_unenroll=can_unenroll, credit_status=credit_status, show_email_settings=show_email_settings, course_mode_info=course_mode_info, is_paid_course=is_paid_course, is_course_voucher_refundable=is_course_voucher_refundable, course_requirements=course_requirements, dashboard_index=dashboard_index, share_settings=share_settings, user=user, related_programs=related_programs, display_course_modes_on_dashboard=display_course_modes_on_dashboard, show_consent_link=show_consent_link, enterprise_customer_name=enterprise_customer_name, resume_button_url=resume_button_url, partner_managed_enrollment=partner_managed_enrollment' /> + <%include file='dashboard/_dashboard_course_listing.html' args='course_overview=course_overview, course_card_index=dashboard_index, enrollment=enrollment, enrollments_fbe_is_on=enrollments_fbe_is_on, is_unfulfilled_entitlement=is_unfulfilled_entitlement, is_fulfilled_entitlement=is_fulfilled_entitlement, entitlement=entitlement, entitlement_session=entitlement_session, entitlement_available_sessions=entitlement_available_sessions, entitlement_expiration_date=entitlement_expiration_date, entitlement_expired_at=entitlement_expired_at, show_courseware_link=show_courseware_link, cert_status=cert_status, can_refund_entitlement=can_refund_entitlement, can_unenroll=can_unenroll, credit_status=credit_status, show_email_settings=show_email_settings, course_mode_info=course_mode_info, is_paid_course=is_paid_course, is_course_voucher_refundable=is_course_voucher_refundable, course_requirements=course_requirements, dashboard_index=dashboard_index, share_settings=share_settings, user=user, related_programs=related_programs, display_course_modes_on_dashboard=display_course_modes_on_dashboard, show_consent_link=show_consent_link, enterprise_customer_name=enterprise_customer_name, resume_button_url=resume_button_url, partner_managed_enrollment=partner_managed_enrollment' /> % endfor % if show_load_all_courses_link:
diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index 316bb88f4936..f696e4946b42 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -1,4 +1,4 @@ -<%page args="course_overview, enrollment, entitlement, entitlement_session, course_card_index, fbe_status_list, is_unfulfilled_entitlement, is_fulfilled_entitlement, entitlement_available_sessions, entitlement_expiration_date, entitlement_expired_at, show_courseware_link, cert_status, can_refund_entitlement, can_unenroll, credit_status, show_email_settings, course_mode_info, is_paid_course, is_course_voucher_refundable, course_requirements, dashboard_index, share_settings, related_programs, display_course_modes_on_dashboard, show_consent_link, enterprise_customer_name, resume_button_url, partner_managed_enrollment" expression_filter="h"/> +<%page args="course_overview, enrollment, entitlement, entitlement_session, course_card_index, enrollments_fbe_is_on, is_unfulfilled_entitlement, is_fulfilled_entitlement, entitlement_available_sessions, entitlement_expiration_date, entitlement_expired_at, show_courseware_link, cert_status, can_refund_entitlement, can_unenroll, credit_status, show_email_settings, course_mode_info, is_paid_course, is_course_voucher_refundable, course_requirements, dashboard_index, share_settings, related_programs, display_course_modes_on_dashboard, show_consent_link, enterprise_customer_name, resume_button_url, partner_managed_enrollment" expression_filter="h"/> <%! import datetime @@ -48,8 +48,6 @@ and not entitlement and course_mode_info['verified_sku'] ) - for fbe_is_on in fbe_status_list: - fbe_is_on = fbe_is_on %> <% @@ -384,26 +382,28 @@

- % if fbe_is_on: - ${Text(_("{start_bold}Get the most out of your course!{end_bold} Upgrade to get full access to the course material, unlock both graded and non-graded assignments, and earn a {link_start}verified certificate{link_end} to showcase on your resumé.")).format( - start_bold=HTML(''), - end_bold=HTML(''), - link_start=HTML('').format( - marketing_link('WHAT_IS_VERIFIED_CERT'), - enrollment.course_id - ), - link_end=HTML('') - )} - % else: - ${Text(_("{start_bold}Get the most out of your course!{end_bold} Upgrade to earn a {link_start}verified certificate{link_end} to showcase on your resumé.")).format( - start_bold=HTML(''), - end_bold=HTML(''), - link_start=HTML('').format( - marketing_link('WHAT_IS_VERIFIED_CERT'), - enrollment.course_id - ), - link_end=HTML('') - )} + % if enrollments_fbe_is_on: + % if enrollments_fbe_is_on[dashboard_index]: + ${Text(_("{start_bold}Get the most out of your course!{end_bold} Upgrade to get full access to the course material, unlock both graded and non-graded assignments, and earn a {link_start}verified certificate{link_end} to showcase on your resumé.")).format( + start_bold=HTML(''), + end_bold=HTML(''), + link_start=HTML('').format( + marketing_link('WHAT_IS_VERIFIED_CERT'), + enrollment.course_id + ), + link_end=HTML('') + )} + % else: + ${Text(_("{start_bold}Get the most out of your course!{end_bold} Upgrade to earn a {link_start}verified certificate{link_end} to showcase on your resumé.")).format( + start_bold=HTML(''), + end_bold=HTML(''), + link_start=HTML('').format( + marketing_link('WHAT_IS_VERIFIED_CERT'), + enrollment.course_id + ), + link_end=HTML('') + )} + % endif % endif