Skip to content

Commit

Permalink
fix: Use dashboard_index to get FBE status (openedx#30463)
Browse files Browse the repository at this point in the history
REV-2466
  • Loading branch information
julianajlk authored May 24, 2022
1 parent 23aa0d3 commit e25e17e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions common/djangoapps/student/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion lms/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -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:
<br/>
Expand Down
46 changes: 23 additions & 23 deletions lms/templates/dashboard/_dashboard_course_listing.html
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
%>

<%
Expand Down Expand Up @@ -384,26 +382,28 @@ <h3 class="course-title" id="course-title-${enrollment.course_id}">
<path d="M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94A5.01 5.01 0 0011 15.9V19H7v2h10v-2h-4v-3.1a5.01 5.01 0 003.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2zM5 8V7h2v3.82C5.84 10.4 5 9.3 5 8zm14 0c0 1.3-.84 2.4-2 2.82V7h2v1z" fill="currentColor"></path>
</svg>
<div class="message-copy" align="auto">
% 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('<strong class="message-copy-bold">'),
end_bold=HTML('</strong>'),
link_start=HTML('<a href="{}" class="verified-info" data-course-key="{}">').format(
marketing_link('WHAT_IS_VERIFIED_CERT'),
enrollment.course_id
),
link_end=HTML('</a>')
)}
% 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('<strong class="message-copy-bold">'),
end_bold=HTML('</strong>'),
link_start=HTML('<a href="{}" class="verified-info" data-course-key="{}">').format(
marketing_link('WHAT_IS_VERIFIED_CERT'),
enrollment.course_id
),
link_end=HTML('</a>')
)}
% 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('<strong class="message-copy-bold">'),
end_bold=HTML('</strong>'),
link_start=HTML('<a href="{}" class="verified-info" data-course-key="{}">').format(
marketing_link('WHAT_IS_VERIFIED_CERT'),
enrollment.course_id
),
link_end=HTML('</a>')
)}
% 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('<strong class="message-copy-bold">'),
end_bold=HTML('</strong>'),
link_start=HTML('<a href="{}" class="verified-info" data-course-key="{}">').format(
marketing_link('WHAT_IS_VERIFIED_CERT'),
enrollment.course_id
),
link_end=HTML('</a>')
)}
% endif
% endif
</div>
</div>
Expand Down

0 comments on commit e25e17e

Please sign in to comment.