Overall Grade Range in Grading does not show consistant view when grades are removed
TNL2159
This commit is contained in:
@@ -233,6 +233,28 @@ var GradingView = ValidatingView.extend({
|
||||
};
|
||||
},
|
||||
|
||||
renderGradeLabels: function(){
|
||||
// When a grade is removed, keep the remaining grades consistent.
|
||||
var _this = this;
|
||||
if (_this.descendingCutoffs.length === 1 && _this.descendingCutoffs[0]['designation'] === _this.GRADES[0]) {
|
||||
_this.descendingCutoffs[0]['designation'] = 'Pass';
|
||||
_this.setTopGradeLabel();
|
||||
} else {
|
||||
_.each(_this.descendingCutoffs, function(cutoff, index) {
|
||||
cutoff['designation'] = _this.GRADES[index];
|
||||
});
|
||||
_this.updateDomGradeLabels();
|
||||
}
|
||||
},
|
||||
updateDomGradeLabels: function(){
|
||||
// Update the DOM elements (Grades)
|
||||
var _this = this;
|
||||
var gradeElements = this.$el.find('.grades .letter-grade[contenteditable=true]');
|
||||
_.each(gradeElements, function(element, index) {
|
||||
if (index !== 0 ) $(element).text(_this.GRADES[index])
|
||||
});
|
||||
},
|
||||
|
||||
saveCutoffs: function() {
|
||||
this.model.set('grade_cutoffs',
|
||||
_.reduce(this.descendingCutoffs,
|
||||
@@ -292,12 +314,9 @@ var GradingView = ValidatingView.extend({
|
||||
this.descendingCutoffs.splice(index, 1);
|
||||
domElement.remove();
|
||||
|
||||
if (this.descendingCutoffs.length === 1 && this.descendingCutoffs[0]['designation'] === this.GRADES[0]) {
|
||||
this.descendingCutoffs[0]['designation'] = 'Pass';
|
||||
this.setTopGradeLabel();
|
||||
}
|
||||
this.setFailLabel();
|
||||
this.renderGradeRanges();
|
||||
this.renderGradeLabels();
|
||||
this.saveCutoffs();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user