Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: visual and progress score display enhancement #34862

Open
wants to merge 1 commit into
base: open-release/redwood.master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading