Reveal professional pathways in program sidebar.

Professional pathways are referred to as industry pathways in the code
to help differentiate them from professional certificate programs.
This commit is contained in:
Brandon Baker
2018-08-29 12:51:44 -04:00
parent 67f74a3784
commit 171e95f904
12 changed files with 123 additions and 30 deletions

View File

@@ -12,6 +12,7 @@ from web_fragments.fragment import Fragment
from lms.djangoapps.commerce.utils import EcommerceService
from lms.djangoapps.learner_dashboard.utils import FAKE_COURSE_KEY, strip_course_id
from openedx.core.djangoapps.catalog.constants import PathwayType
from openedx.core.djangoapps.catalog.utils import get_pathways
from openedx.core.djangoapps.credentials.utils import get_credentials_records_url
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
@@ -107,12 +108,16 @@ class ProgramDetailsFragmentView(EdxFragmentView):
if not certificate_data:
program_record_url = None
pathways = []
industry_pathways = []
credit_pathways = []
try:
for pathway_id in program_data['pathway_ids']:
pathway = get_pathways(request.site, pathway_id)
if pathway and pathway['email']:
pathways.append(pathway)
if pathway['pathway_type'] == PathwayType.CREDIT.value:
credit_pathways.append(pathway)
elif pathway['pathway_type'] == PathwayType.INDUSTRY.value:
industry_pathways.append(pathway)
# if pathway caching did not complete fully (no pathway_ids)
except KeyError:
pass
@@ -133,7 +138,8 @@ class ProgramDetailsFragmentView(EdxFragmentView):
'program_data': program_data,
'course_data': course_data,
'certificate_data': certificate_data,
'pathways': pathways,
'industry_pathways': industry_pathways,
'credit_pathways': credit_pathways,
}
html = render_to_string('learner_dashboard/program_details_fragment.html', context)