@@ -6,7 +6,6 @@ import json
|
||||
from abc import ABC, abstractmethod
|
||||
from urllib.parse import quote
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.http import Http404
|
||||
from django.template.loader import render_to_string
|
||||
@@ -18,7 +17,7 @@ from web_fragments.fragment import Fragment
|
||||
|
||||
from common.djangoapps.student.models import anonymous_id_for_user
|
||||
from common.djangoapps.student.roles import GlobalStaff
|
||||
from lms.djangoapps.learner_dashboard.utils import b2c_subscriptions_enabled, program_tab_view_is_enabled
|
||||
from lms.djangoapps.learner_dashboard.utils import program_tab_view_is_enabled
|
||||
from openedx.core.djangoapps.catalog.utils import get_programs
|
||||
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
|
||||
from openedx.core.djangoapps.programs.models import (
|
||||
@@ -32,9 +31,7 @@ from openedx.core.djangoapps.programs.utils import (
|
||||
get_industry_and_credit_pathways,
|
||||
get_program_and_course_data,
|
||||
get_program_marketing_url,
|
||||
get_program_subscriptions_marketing_url,
|
||||
get_program_urls,
|
||||
get_programs_subscription_data
|
||||
)
|
||||
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
@@ -60,30 +57,12 @@ class ProgramsFragmentView(EdxFragmentView):
|
||||
raise Http404
|
||||
|
||||
meter = ProgramProgressMeter(request.site, user, mobile_only=mobile_only)
|
||||
is_user_b2c_subscriptions_enabled = b2c_subscriptions_enabled(mobile_only)
|
||||
programs_subscription_data = (
|
||||
get_programs_subscription_data(user)
|
||||
if is_user_b2c_subscriptions_enabled
|
||||
else []
|
||||
)
|
||||
subscription_upsell_data = (
|
||||
{
|
||||
'marketing_url': get_program_subscriptions_marketing_url(),
|
||||
'minimum_price': settings.SUBSCRIPTIONS_MINIMUM_PRICE,
|
||||
'trial_length': settings.SUBSCRIPTIONS_TRIAL_LENGTH,
|
||||
}
|
||||
if is_user_b2c_subscriptions_enabled
|
||||
else {}
|
||||
)
|
||||
|
||||
context = {
|
||||
'marketing_url': get_program_marketing_url(programs_config, mobile_only),
|
||||
'programs': meter.engaged_programs,
|
||||
'progress': meter.progress(),
|
||||
'programs_subscription_data': programs_subscription_data,
|
||||
'subscription_upsell_data': subscription_upsell_data,
|
||||
'user_preferences': get_user_preferences(user),
|
||||
'is_user_b2c_subscriptions_enabled': is_user_b2c_subscriptions_enabled,
|
||||
'mobile_only': bool(mobile_only)
|
||||
}
|
||||
html = render_to_string('learner_dashboard/programs_fragment.html', context)
|
||||
@@ -137,12 +116,6 @@ class ProgramDetailsFragmentView(EdxFragmentView):
|
||||
|
||||
program_discussion_lti = ProgramDiscussionLTI(program_uuid, request)
|
||||
program_live_lti = ProgramLiveLTI(program_uuid, request)
|
||||
is_user_b2c_subscriptions_enabled = b2c_subscriptions_enabled(mobile_only)
|
||||
program_subscription_data = (
|
||||
get_programs_subscription_data(user, program_uuid)
|
||||
if is_user_b2c_subscriptions_enabled
|
||||
else []
|
||||
)
|
||||
|
||||
def program_tab_view_enabled() -> bool:
|
||||
return program_tab_view_is_enabled() and (
|
||||
@@ -156,14 +129,11 @@ class ProgramDetailsFragmentView(EdxFragmentView):
|
||||
'urls': urls,
|
||||
'user_preferences': get_user_preferences(user),
|
||||
'program_data': program_data,
|
||||
'program_subscription_data': program_subscription_data,
|
||||
'course_data': course_data,
|
||||
'certificate_data': certificate_data,
|
||||
'industry_pathways': industry_pathways,
|
||||
'credit_pathways': credit_pathways,
|
||||
'program_tab_view_enabled': program_tab_view_enabled(),
|
||||
'is_user_b2c_subscriptions_enabled': is_user_b2c_subscriptions_enabled,
|
||||
'subscriptions_trial_length': settings.SUBSCRIPTIONS_TRIAL_LENGTH,
|
||||
'discussion_fragment': {
|
||||
'configured': program_discussion_lti.is_configured,
|
||||
'iframe': program_discussion_lti.render_iframe()
|
||||
|
||||
Reference in New Issue
Block a user