fix: visual and progress score display enhancement

This commit is contained in:
ihor-romaniuk
2024-05-27 15:31:47 +02:00
committed by Adolfo R. Brandes
parent 5972b40b2f
commit 30f23f30dc

View File

@@ -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);