diff --git a/xmodule/js/src/capa/display.js b/xmodule/js/src/capa/display.js index f4254b43f8ff..9bc5591acd4f 100644 --- a/xmodule/js/src/capa/display.js +++ b/xmodule/js/src/capa/display.js @@ -290,14 +290,21 @@ Problem.prototype.updateProgress = function(response) { if (response.progress_changed) { - this.el.data('problem-score', response.current_score); - this.el.data('problem-total-possible', response.total_possible); + this.el.data('problem-score', this.convertToFloat(response.current_score)); + this.el.data('problem-total-possible', this.convertToFloat(response.total_possible)); this.el.data('attempts-used', response.attempts_used); this.el.trigger('progressChanged'); } return this.renderProgressState(); }; + Problem.prototype.convertToFloat = function(num) { + if (typeof num !== 'number' || !Number.isInteger(num)) { + return num; + } + return num.toFixed(1); + }; + Problem.prototype.forceUpdate = function(response) { this.el.data('problem-score', response.current_score); this.el.data('problem-total-possible', response.total_possible);