Skip to content

Commit

Permalink
don't show feedback messages which affect credit in parts with "show …
Browse files Browse the repository at this point in the history
…feedback icon" turned off

"show feedback icon" really means "this part doesn't have a correct
answer, so feedback messages like "this is incorrect" shouldn't be
shown.

Feedback messages which don't affect credit are still shown, so a custom
marking algorithm could give information about the student's answer, if
necessary.
  • Loading branch information
christianp committed Feb 7, 2019
1 parent e6b35ba commit f92e4c8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
52 changes: 30 additions & 22 deletions runtime/scripts/part.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -993,12 +993,14 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
{ {
var oCredit = this.credit; var oCredit = this.credit;
this.credit = credit; this.credit = credit;
this.markingFeedback.push({ if(this.settings.showFeedbackIcon) {
op: 'set_credit', this.markingFeedback.push({
credit: this.credit - oCredit, op: 'set_credit',
message: message, credit: this.credit - oCredit,
reason: reason message: message,
}); reason: reason
});
}
}, },
/** Add an absolute value to `credit` /** Add an absolute value to `credit`
* @param {Number} credit - amount to add * @param {Number} credit - amount to add
Expand All @@ -1007,11 +1009,13 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
addCredit: function(credit,message) addCredit: function(credit,message)
{ {
this.credit += credit; this.credit += credit;
this.markingFeedback.push({ if(this.settings.showFeedbackIcon) {
op: 'add_credit', this.markingFeedback.push({
credit: credit, op: 'add_credit',
message: message credit: credit,
}); message: message
});
}
}, },
/** Subtract an absolute value from `credit` /** Subtract an absolute value from `credit`
* @param {Number} credit - amount to subtract * @param {Number} credit - amount to subtract
Expand All @@ -1020,11 +1024,13 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
subCredit: function(credit,message) subCredit: function(credit,message)
{ {
this.credit -= credit; this.credit -= credit;
this.markingFeedback.push({ if(this.settings.showFeedbackIcon) {
op: 'sub_credit', this.markingFeedback.push({
credit: credit, op: 'sub_credit',
message: message credit: credit,
}); message: message
});
}
}, },
/** Multiply `credit` by the given amount - use to apply penalties /** Multiply `credit` by the given amount - use to apply penalties
* @param {Number} factor * @param {Number} factor
Expand All @@ -1034,12 +1040,14 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
{ {
var oCredit = this.credit var oCredit = this.credit
this.credit *= factor; this.credit *= factor;
this.markingFeedback.push({ if(this.settings.showFeedbackIcon) {
op: 'multiply_credit', this.markingFeedback.push({
credit: this.credit - oCredit, op: 'multiply_credit',
factor: factor, credit: this.credit - oCredit,
message: message factor: factor,
}); message: message
});
}
}, },
/** Add a comment to the marking feedback /** Add a comment to the marking feedback
* @param {String} message * @param {String} message
Expand Down
1 change: 1 addition & 0 deletions themes/default/files/resources/exam.css
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ table {


.part .partFeedback { .part .partFeedback {
margin-top: 1em; margin-top: 1em;
text-align: right;
} }


.part .feedbackMessages { .part .feedbackMessages {
Expand Down

0 comments on commit f92e4c8

Please sign in to comment.