From 87a1b2355c1eb653947d82583493ccd23982c3b1 Mon Sep 17 00:00:00 2001 From: ihor-romaniuk Date: Mon, 27 May 2024 15:31:47 +0200 Subject: [PATCH 1/2] fix: visual and progress score display enhancement --- xmodule/js/src/capa/display.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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); From ca0d6f3b4925c028543b1100419aedb033d48126 Mon Sep 17 00:00:00 2001 From: ihor-romaniuk Date: Mon, 3 Feb 2025 11:19:55 +0100 Subject: [PATCH 2/2] fix: add missing styles --- .../css-builtin-blocks/ProblemBlockDisplay.css | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/xmodule/static/css-builtin-blocks/ProblemBlockDisplay.css b/xmodule/static/css-builtin-blocks/ProblemBlockDisplay.css index aa731796f44b..2804f39ff5e5 100644 --- a/xmodule/static/css-builtin-blocks/ProblemBlockDisplay.css +++ b/xmodule/static/css-builtin-blocks/ProblemBlockDisplay.css @@ -179,6 +179,7 @@ .xmodule_display.xmodule_ProblemBlock div.problem .choicegroup, .xmodule_display.xmodule_ProblemBlock div.problem .choicetextgroup { + margin: var(--baseline, 20px) 0 0 0; min-width: 100px; width: auto !important; width: 100px; @@ -405,7 +406,7 @@ .xmodule_display.xmodule_ProblemBlock div.problem .choicegroup input[type="checkbox"] { left: 0.5625em; position: absolute; - top: 0.35em; + top: 0.43em; width: calc(var(--baseline, 20px) * 1.1); height: calc(var(--baseline, 20px) * 1.1); z-index: 1; @@ -636,10 +637,10 @@ } .xmodule_display.xmodule_ProblemBlock div.problem div .grader-status .grading { - margin: 0px 7px 0 0; + margin: 0 7px 0 0; padding-left: 25px; background: var(--icon-info) left center no-repeat; - text-indent: 0px; + text-indent: 0; } .xmodule_display.xmodule_ProblemBlock div.problem div .grader-status p { @@ -701,7 +702,7 @@ } .xmodule_display.xmodule_ProblemBlock div.problem div .submit-message-container { - margin: var(--baseline, 20px) 0px; + margin: var(--baseline, 20px) 0; } .xmodule_display.xmodule_ProblemBlock div.problem div.inline>span { @@ -878,6 +879,11 @@ content: ""; } +.xmodule_display.xmodule_ProblemBlock .problem .capa_inputtype.textline>.submitted, +.xmodule_display.xmodule_ProblemBlock .problem .inputtype.formulaequationinput>.submitted { + margin: var(--baseline, 20px) 0 0 0; +} + .xmodule_display.xmodule_ProblemBlock .problem .capa_inputtype.textline>.submitted input, .xmodule_display.xmodule_ProblemBlock .problem .inputtype.formulaequationinput>.submitted input { border: 2px solid var(--submitted, #0075b4); @@ -914,7 +920,7 @@ } .xmodule_display.xmodule_ProblemBlock .problem .inputtype.option-input { - margin: 0 0 0 0 !important; + margin: var(--baseline, 20px) 0 0 0 !important; } .xmodule_display.xmodule_ProblemBlock .problem .inputtype.option-input .indicator-container { @@ -975,7 +981,7 @@ } .xmodule_display.xmodule_ProblemBlock div.problem .CodeMirror-scroll { - margin-right: 0px; + margin-right: 0; } .xmodule_display.xmodule_ProblemBlock .capa-message {