Only allow enrollment in published runs on the program detail page
Course runs indicated to be upcoming are also restricted to those runs that are published. LEARNER-942
This commit is contained in:
@@ -63,7 +63,8 @@
|
||||
rawCourseRuns = _.where(this.context.course_runs, {
|
||||
is_enrollment_open: true,
|
||||
is_enrolled: false,
|
||||
is_course_ended: false
|
||||
is_course_ended: false,
|
||||
status: 'published'
|
||||
});
|
||||
|
||||
// Deep copy to avoid mutating this.context.
|
||||
@@ -90,7 +91,8 @@
|
||||
return _.where(this.context.course_runs, {
|
||||
is_enrollment_open: false,
|
||||
is_enrolled: false,
|
||||
is_course_ended: false
|
||||
is_course_ended: false,
|
||||
status: 'published'
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ define([
|
||||
is_course_ended: false,
|
||||
is_enrolled: true,
|
||||
is_enrollment_open: true,
|
||||
status: 'published',
|
||||
upgrade_url: ''
|
||||
}
|
||||
]
|
||||
|
||||
@@ -57,6 +57,7 @@ define([
|
||||
is_course_ended: false,
|
||||
is_enrolled: false,
|
||||
is_enrollment_open: true,
|
||||
status: 'published',
|
||||
upgrade_url: ''
|
||||
}];
|
||||
|
||||
@@ -80,7 +81,8 @@ define([
|
||||
enrollment_open_date: 'Jan 18, 2016',
|
||||
is_course_ended: false,
|
||||
is_enrolled: false,
|
||||
is_enrollment_open: true
|
||||
is_enrollment_open: true,
|
||||
status: 'published'
|
||||
}, {
|
||||
key: 'course-v1:WageningenX+FFESx+1T2017',
|
||||
uuid: '2f2edf03-79e6-4e39-aef0-65436a6ee344',
|
||||
@@ -99,7 +101,8 @@ define([
|
||||
enrollment_open_date: 'Jan 18, 2016',
|
||||
is_course_ended: false,
|
||||
is_enrolled: false,
|
||||
is_enrollment_open: true
|
||||
is_enrollment_open: true,
|
||||
status: 'published'
|
||||
}];
|
||||
});
|
||||
|
||||
@@ -150,7 +153,6 @@ define([
|
||||
it('should not render anything if course runs are empty', function() {
|
||||
setupView([]);
|
||||
|
||||
expect(view.$('.enrollment-info').length).toBe(0);
|
||||
expect(view.$('.run-select').length).toBe(0);
|
||||
expect(view.$('.enroll-button').length).toBe(0);
|
||||
});
|
||||
@@ -163,6 +165,22 @@ define([
|
||||
expect(view.$('.run-select option').length).toBe(2);
|
||||
});
|
||||
|
||||
it('should not allow enrollment in unpublished course runs', function() {
|
||||
multiCourseRunList[0].status = 'unpublished';
|
||||
|
||||
setupView(multiCourseRunList);
|
||||
expect(view.$('.run-select').length).toBe(0);
|
||||
expect(view.$('.enroll-button').length).toBe(1);
|
||||
});
|
||||
|
||||
it('should not allow enrollment in course runs with a null status', function() {
|
||||
multiCourseRunList[0].status = null;
|
||||
|
||||
setupView(multiCourseRunList);
|
||||
expect(view.$('.run-select').length).toBe(0);
|
||||
expect(view.$('.enroll-button').length).toBe(1);
|
||||
});
|
||||
|
||||
it('should enroll learner when enroll button is clicked with one course run available', function() {
|
||||
setupView(singleCourseRunList);
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ define([
|
||||
modified: '2017-03-24T14:22:15.609907Z',
|
||||
is_enrolled: true,
|
||||
pacing_type: 'self_paced',
|
||||
video: null
|
||||
video: null,
|
||||
status: 'published'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -268,7 +269,8 @@ define([
|
||||
modified: '2017-03-24T14:16:47.547643Z',
|
||||
is_enrolled: true,
|
||||
pacing_type: 'instructor_paced',
|
||||
video: null
|
||||
video: null,
|
||||
status: 'published'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -372,7 +374,8 @@ define([
|
||||
modified: '2017-03-24T14:18:08.693748Z',
|
||||
is_enrolled: false,
|
||||
pacing_type: 'instructor_paced',
|
||||
video: null
|
||||
video: null,
|
||||
status: 'published'
|
||||
},
|
||||
{
|
||||
upgrade_url: null,
|
||||
@@ -445,7 +448,8 @@ define([
|
||||
modified: '2017-03-23T16:47:37.108260Z',
|
||||
is_enrolled: false,
|
||||
pacing_type: 'self_paced',
|
||||
video: null
|
||||
video: null,
|
||||
status: 'published'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user