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 May 27, 2024
1 parent 4ba603c commit cc77b4d
Show file tree
Hide file tree
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
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -646,7 +647,7 @@ div.problem {
}

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

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -946,7 +950,7 @@ div.problem {
}

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

Expand Down
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 cc77b4d

Please sign in to comment.