Skip to content

Commit

Permalink
fix: visual and progress score display enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-romaniuk committed Dec 3, 2024
1 parent 1397673 commit 3e388a7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions xmodule/js/src/capa/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3e388a7

Please sign in to comment.