diff --git a/lms/djangoapps/learner_dashboard/programs.py b/lms/djangoapps/learner_dashboard/programs.py index 5db6bc9688..2db218ef6d 100644 --- a/lms/djangoapps/learner_dashboard/programs.py +++ b/lms/djangoapps/learner_dashboard/programs.py @@ -78,7 +78,8 @@ class ProgramsFragmentView(EdxFragmentView): 'progress': meter.progress(), 'programs_subscription_data': programs_subscription_data, 'user_preferences': get_user_preferences(user), - 'is_user_b2c_subscriptions_enabled': is_user_b2c_subscriptions_enabled + '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) programs_fragment = Fragment(html) diff --git a/lms/static/js/learner_dashboard/models/program_subscription_model.js b/lms/static/js/learner_dashboard/models/program_subscription_model.js index 8e491de9f2..f907b8938c 100644 --- a/lms/static/js/learner_dashboard/models/program_subscription_model.js +++ b/lms/static/js/learner_dashboard/models/program_subscription_model.js @@ -110,14 +110,17 @@ class ProgramSubscriptionModel extends Backbone.Model { const trialEndTime = DateUtils.localizeTime( DateUtils.stringToMoment(trialEndDate), userTimezone - ).startOf('day'); + ); const currentTime = DateUtils.localizeTime( moment.utc(), userTimezone - ).startOf('day'); - - return trialEndTime.diff(currentTime, 'days'); + ); + return trialEndTime.diff(currentTime, 'days') < 1 + ? // 0 if trial end time is less than 24 hrs + 0 + : // else return actual difference in days + trialEndTime.startOf('day').diff(currentTime.startOf('day'), 'days'); } } diff --git a/lms/static/js/learner_dashboard/program_list_factory.js b/lms/static/js/learner_dashboard/program_list_factory.js index c577122ba0..b50fcd08bc 100644 --- a/lms/static/js/learner_dashboard/program_list_factory.js +++ b/lms/static/js/learner_dashboard/program_list_factory.js @@ -22,9 +22,11 @@ function ProgramListFactory(options) { } if (options.programsData.length) { - new HeaderView({ - context: options, - }).render(); + if (!options.mobileOnly) { + new HeaderView({ + context: options, + }).render(); + } const activeSubscriptions = options.programsSubscriptionData .filter(({ subscription_state }) => subscription_state === 'active') diff --git a/lms/templates/learner_dashboard/programs_fragment.html b/lms/templates/learner_dashboard/programs_fragment.html index 74aa49054f..b550f98784 100644 --- a/lms/templates/learner_dashboard/programs_fragment.html +++ b/lms/templates/learner_dashboard/programs_fragment.html @@ -11,7 +11,9 @@ from openedx.core.djangolib.js_utils import (