Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: visual and progress score display enhancement
Browse files Browse the repository at this point in the history
ihor-romaniuk committed Sep 3, 2024
1 parent 493e7ef commit a8a002e
Showing 2 changed files with 20 additions and 9 deletions.
18 changes: 11 additions & 7 deletions xmodule/assets/capa/_display.scss
Original file line number Diff line number Diff line change
@@ -209,6 +209,7 @@ div.problem {
// Choice Group - silent class
%choicegroup-base {
@include clearfix();
@include margin($baseline, 0 0 0);

min-width: 100px;
width: auto !important;
@@ -307,7 +308,7 @@ div.problem {
@include left(em(9));

position: absolute;
top: 0.35em;
top: .43em;
width: $baseline*1.1;
height: $baseline*1.1;
z-index: 1;
@@ -572,10 +573,10 @@ div.problem {
}

.grading {
margin: 0px 7px 0 0;
margin: 0 7px 0 0;
padding-left: 25px;
background: url('#{$static-path}/images/info-icon.png') left center no-repeat;
text-indent: 0px;
text-indent: 0;
}

p {
@@ -646,7 +647,7 @@ div.problem {
}

.submit-message-container {
margin: $baseline 0px ;
margin: $baseline 0;
}
}

@@ -780,7 +781,10 @@ div.problem {
// +Problem - Text Input, Numerical Input
// ====================
.problem {
.capa_inputtype.textline, .inputtype.formulaequationinput {
.capa_inputtype.textline,
.inputtype.formulaequationinput {
@include margin($baseline, 0 0 0);

input {
box-sizing: border-box;

@@ -879,7 +883,7 @@ div.problem {
// ====================
.problem {
.inputtype.option-input {
margin: 0 0 0 0 !important;
margin: $baseline 0 0 0 !important;

.indicator-container {
display: inline-block;
@@ -946,7 +950,7 @@ div.problem {
}

.CodeMirror-scroll {
margin-right: 0px;
margin-right: 0;
}
}

11 changes: 9 additions & 2 deletions xmodule/js/src/capa/display.js
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit a8a002e

Please sign in to comment.