Skip to content
Snippets Groups Projects
Unverified Commit 2b2560f6 authored by Matthew Piatetsky's avatar Matthew Piatetsky Committed by GitHub
Browse files

Merge pull request #19278 from edx/REV-620

[REVE-620] handle case when list of programs for course is empty
parents fb5ad203 6f8090ea
No related branches found
No related tags found
No related merge requests found
......@@ -154,22 +154,24 @@ class ChooseModeView(View):
meter_inverted_programs = meter.invert_programs()
if len(meter_inverted_programs) > 0:
# program for the course on this page
program_for_course = meter_inverted_programs.get(course_id)[0]
program_uuid = program_for_course.get('uuid')
if program_for_course:
# program data with bundle info
program_data = ProgramDataExtender(program_for_course, request.user, mobile_only=False).extend()
skus = program_data.get('skus')
ecommerce_service = EcommerceService()
program_bundle_url = ecommerce_service.get_checkout_page_url(*skus, program_uuid=program_uuid)
bundle_data = {
'program_marketing_site_url': program_data.get('marketing_url'),
'program_bundle_url': program_bundle_url,
'discount_data': program_data.get('discount_data'),
'program_type': program_data.get('type'),
'program_title': program_data.get('title'),
'program_price': program_data.get('full_program_price'),
}
programs_for_course = meter_inverted_programs.get(course_id)
if programs_for_course:
program_for_course = programs_for_course[0]
program_uuid = program_for_course.get('uuid')
if program_for_course:
# program data with bundle info
program_data = ProgramDataExtender(program_for_course, request.user, mobile_only=False).extend()
skus = program_data.get('skus')
ecommerce_service = EcommerceService()
program_bundle_url = ecommerce_service.get_checkout_page_url(*skus, program_uuid=program_uuid)
bundle_data = {
'program_marketing_site_url': program_data.get('marketing_url'),
'program_bundle_url': program_bundle_url,
'discount_data': program_data.get('discount_data'),
'program_type': program_data.get('type'),
'program_title': program_data.get('title'),
'program_price': program_data.get('full_program_price'),
}
context = {
"bundle_data": bundle_data,
......@@ -179,7 +181,7 @@ class ChooseModeView(View):
),
"modes": modes,
"has_credit_upsell": has_credit_upsell,
"course_name": course.display_name_with_default_escaped,
"course_name": course.display_name_with_default,
"course_org": course.display_org_with_default,
"course_num": course.display_number_with_default,
"chosen_price": chosen_price,
......@@ -196,7 +198,7 @@ class ChooseModeView(View):
)
title_content = _("Congratulations! You are now enrolled in {course_name}").format(
course_name=course.display_name_with_default_escaped
course_name=course.display_name_with_default
)
context["title_content"] = title_content
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment