Skip to content

Commit

Permalink
Merge pull request #936 from edx/mohtamba/remove-old-allowance-code
Browse files Browse the repository at this point in the history
Mohtamba/remove old allowance code
  • Loading branch information
mohtamba authored Aug 17, 2021
2 parents 702a48c + 4909bc8 commit 9af05d8
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 1,020 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[3.23.3] - 2021-08-16
~~~~~~~~~~~~~~~~~~~~~
* Remove the old allowance code entirely, so only the bulk allowance modal is used.

[3.23.2] - 2021-08-06
~~~~~~~~~~~~~~~~~~~~~
* Change errors on the bulk allowance modal so they appear on their associated field.
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '3.23.2'
__version__ = '3.23.3'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,8 @@ edx = edx || {};
/* unfortunately we have to make some assumptions about what is being set up in HTML */
this.setElement($('.special-allowance-container'));
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;
this.initial_url = this.collection.url;
this.allowance_url = this.initial_url + 'allowance';
Expand Down Expand Up @@ -121,11 +112,7 @@ edx = edx || {};
/* we might - at some point - add a visual element to the */
/* loading, like a spinner */
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({
success: function() {
self.render();
Expand All @@ -137,50 +124,24 @@ edx = edx || {};
},
render: 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);
}
},
showAddModal: function(event) {
var self = this;
self.proctoredExamCollection.fetch({
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
});
}
});
event.stopPropagation();
Expand Down
Loading

0 comments on commit 9af05d8

Please sign in to comment.