@edx/edx-proctoring
Advanced tools
Comparing version 3.23.2 to 3.23.3
@@ -22,13 +22,4 @@ edx = edx || {}; | ||
this.course_id = this.$el.data('course-id'); | ||
/* we need to check if the bulk allowance waffle flag is enabled */ | ||
this.enableBulkAllowance = | ||
this.$el.data('enable-bulk-allowance'); | ||
this.enableBulkAllowance = this.enableBulkAllowance && | ||
this.enableBulkAllowance.toLowerCase() === 'true'; | ||
/* this should be moved to a 'data' attribute in HTML */ | ||
if (this.enableBulkAllowance) { | ||
this.template_url = '/static/proctoring/templates/course_grouped_allowances.underscore'; | ||
} else { | ||
this.template_url = '/static/proctoring/templates/course_allowances.underscore'; | ||
} | ||
this.template_url = '/static/proctoring/templates/course_grouped_allowances.underscore'; | ||
this.template = null; | ||
@@ -125,7 +116,3 @@ this.initial_url = this.collection.url; | ||
var self = this; | ||
if (self.enableBulkAllowance) { | ||
self.collection.url = self.initial_url + self.course_id + '/grouped/allowance'; | ||
} else { | ||
self.collection.url = self.initial_url + self.course_id + '/allowance'; | ||
} | ||
self.collection.url = self.initial_url + self.course_id + '/grouped/allowance'; | ||
self.collection.fetch({ | ||
@@ -142,22 +129,6 @@ success: function() { | ||
var self = this; | ||
var key, i, html; | ||
var html; | ||
if (this.template !== null) { | ||
if (!this.enableBulkAllowance) { | ||
this.collection.each(function(item) { | ||
key = item.get('key'); | ||
for (i = 0; i < self.allowance_types.length; i += 1) { | ||
if (key === self.allowance_types[i][0]) { | ||
item.set('key_display_name', self.allowance_types[i][1]); | ||
break; | ||
} | ||
} | ||
if (!item.has('key_display_name')) { | ||
item.set('key_display_name', key); | ||
} | ||
}); | ||
html = this.template({proctored_exam_allowances: this.collection.toJSON()}); | ||
} else { | ||
html = this.template({proctored_exam_allowances: this.collection.toJSON()[0], | ||
allowance_types: self.allowance_types}); | ||
} | ||
html = this.template({proctored_exam_allowances: this.collection.toJSON()[0], | ||
allowance_types: self.allowance_types}); | ||
this.$el.html(html); | ||
@@ -170,19 +141,9 @@ } | ||
success: function() { | ||
if (!self.enableBulkAllowance) { | ||
// eslint-disable-next-line no-new | ||
new edx.instructor_dashboard.proctoring.AddAllowanceView({ | ||
course_id: self.course_id, | ||
proctored_exams: self.proctoredExamCollection.toJSON(), | ||
proctored_exam_allowance_view: self, | ||
allowance_types: self.allowance_types | ||
}); | ||
} else { | ||
// eslint-disable-next-line no-new | ||
new edx.instructor_dashboard.proctoring.AddBulkAllowanceView({ | ||
course_id: self.course_id, | ||
proctored_exams: self.proctoredExamCollection.toJSON(), | ||
proctored_exam_allowance_view: self, | ||
allowance_types: self.allowance_types | ||
}); | ||
} | ||
// eslint-disable-next-line no-new | ||
new edx.instructor_dashboard.proctoring.AddBulkAllowanceView({ | ||
course_id: self.course_id, | ||
proctored_exams: self.proctoredExamCollection.toJSON(), | ||
proctored_exam_allowance_view: self, | ||
allowance_types: self.allowance_types | ||
}); | ||
} | ||
@@ -189,0 +150,0 @@ }); |
@@ -146,4 +146,3 @@ describe('ProctoredExamAAllowanceView', function() { | ||
setFixtures('<div class="special-allowance-container" data-course-id="test_course_id"' + | ||
'data-enable-bulk-allowance="True"></div>'); | ||
setFixtures('<div class="special-allowance-container" data-course-id="test_course_id"'); | ||
// load the underscore template response before calling the proctored exam allowance view. | ||
@@ -150,0 +149,0 @@ this.server.respondWith('GET', '/static/proctoring/templates/add-new-bulk-allowance.underscore', |
@@ -6,3 +6,3 @@ describe('ProctoredExamAllowanceView', function() { | ||
var expectedProctoredAllowanceJson = [{ | ||
student: [{ | ||
testuser1: [{ | ||
created: '2015-08-10T09:15:45Z', | ||
@@ -36,4 +36,3 @@ id: 1, | ||
this.server.autoRespond = true; | ||
setFixtures('<div class="special-allowance-container" data-course-id="test_course_id"' + | ||
'data-enable-bulk-allowance="True"></div>'); | ||
setFixtures('<div class="special-allowance-container" data-course-id="test_course_id"></div>'); | ||
@@ -68,4 +67,2 @@ // load the underscore template response before calling the proctored exam allowance view. | ||
expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
.toContain('testuser1'); | ||
expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
.toContain('testuser1@test.com'); | ||
@@ -77,28 +74,2 @@ expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
}); | ||
// | ||
it('should remove the proctored exam allowance', function() { | ||
this.server.respondWith('GET', '/api/edx_proctoring/v1/proctored_exam/test_course_id/grouped/allowance', | ||
[ | ||
200, | ||
{ | ||
'Content-Type': 'application/json' | ||
}, | ||
JSON.stringify(expectedProctoredAllowanceJson) | ||
] | ||
); | ||
this.proctored_exam_allowance = new edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView(); | ||
this.server.respond(); | ||
this.server.respond(); | ||
expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
.toContain('testuser1'); | ||
expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
.toContain('testuser1@test.com'); | ||
expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
.toContain('Additional time (minutes)'); | ||
expect(this.proctored_exam_allowance.$el.find('tr.allowance-items').html()) | ||
.toContain('Test Exam'); | ||
}); | ||
}); |
{ | ||
"name": "@edx/edx-proctoring", | ||
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.", | ||
"version": "3.23.2", | ||
"version": "3.23.3", | ||
"main": "edx_proctoring/static/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
1010965
49
18423