feat: update subscription enrollment alert (#32414)
This commit is contained in:
@@ -40,7 +40,7 @@ describe('Program Alert List View', () => {
|
||||
|
||||
it('should render no enrollement alert', () => {
|
||||
expect(view.$('.alert:first .alert-heading').text().trim()).toEqual(
|
||||
'Enroll in a Test Program course'
|
||||
'Enroll in a Test Program\'s course'
|
||||
);
|
||||
expect(view.$('.alert:first .alert-message').text().trim()).toEqual(
|
||||
'You have an active subscription to the Test Program program but are not enrolled in any courses. Enroll in a remaining course and enjoy verified access.'
|
||||
|
||||
@@ -39,12 +39,14 @@ describe('Program List Header View', () => {
|
||||
completed: 0,
|
||||
in_progress: 1,
|
||||
not_started: 0,
|
||||
all_unenrolled: false,
|
||||
},
|
||||
{
|
||||
uuid: 'b90d70d5-f981-4508-bdeb-5b792d930c03',
|
||||
completed: 0,
|
||||
in_progress: 0,
|
||||
not_started: 3,
|
||||
all_unenrolled: true,
|
||||
},
|
||||
],
|
||||
isUserB2CSubscriptionsEnabled: true,
|
||||
@@ -79,7 +81,7 @@ describe('Program List Header View', () => {
|
||||
it('should render a program alert', () => {
|
||||
expect(
|
||||
view.$('.js-program-list-alerts .alert .alert-heading').html().trim()
|
||||
).toEqual('Enroll in a Test Program course');
|
||||
).toEqual('Enroll in a Test Program\'s course');
|
||||
expect(
|
||||
view.$('.js-program-list-alerts .alert .alert-message')
|
||||
).toContainHtml(
|
||||
|
||||
@@ -36,7 +36,7 @@ class ProgramAlertListView extends Backbone.View {
|
||||
url,
|
||||
urlText: gettext('View program'),
|
||||
title: StringUtils.interpolate(
|
||||
gettext('Enroll in a {programName} course'),
|
||||
gettext('Enroll in a {programName}\'s course'),
|
||||
{ programName }
|
||||
),
|
||||
message: this.pageType === 'programDetails'
|
||||
|
||||
@@ -217,10 +217,7 @@ class ProgramDetailsView extends Backbone.View {
|
||||
trialEndingAlerts: [],
|
||||
};
|
||||
if (this.subscriptionModel.get('subscriptionState') === 'active') {
|
||||
if (
|
||||
this.courseData.get('in_progress').length === 0 &&
|
||||
this.courseData.get('not_started').length >= 1
|
||||
) {
|
||||
if (this.courseData.get('all_unenrolled')) {
|
||||
alerts.enrollmentAlerts.push({
|
||||
title: this.programModel.get('title'),
|
||||
});
|
||||
|
||||
@@ -58,18 +58,15 @@ class ProgramListHeaderView extends Backbone.View {
|
||||
|
||||
getEnrollmentAlerts() {
|
||||
return this.programAndSubscriptionData
|
||||
.map(({ programData, subscriptionData }) => {
|
||||
const progress = this.context.progressCollection?.findWhere({
|
||||
.map(({ programData, subscriptionData }) =>
|
||||
this.context.progressCollection?.findWhere({
|
||||
uuid: programData.uuid,
|
||||
in_progress: 0,
|
||||
});
|
||||
return (
|
||||
progress?.get('not_started') >= 1 && {
|
||||
title: programData.title,
|
||||
url: programData.detail_url,
|
||||
}
|
||||
);
|
||||
})
|
||||
all_unenrolled: true,
|
||||
}) ? {
|
||||
title: programData.title,
|
||||
url: programData.detail_url,
|
||||
} : null
|
||||
)
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user