Skip to content
Permalink
Browse files

don't show feedback messages which affect credit in parts with "show …

…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 f92e4c8ce0cbc5c70dc6e31dcc9b467278bafeb1
Showing with 31 additions and 22 deletions.
  1. +30 −22 runtime/scripts/part.js
  2. +1 −0 themes/default/files/resources/exam.css
@@ -993,12 +993,14 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
{
var oCredit = this.credit;
this.credit = credit;
this.markingFeedback.push({
op: 'set_credit',
credit: this.credit - oCredit,
message: message,
reason: reason
});
if(this.settings.showFeedbackIcon) {
this.markingFeedback.push({
op: 'set_credit',
credit: this.credit - oCredit,
message: message,
reason: reason
});
}
},
/** Add an absolute value to `credit`
* @param {Number} credit - amount to add
@@ -1007,11 +1009,13 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
addCredit: function(credit,message)
{
this.credit += credit;
this.markingFeedback.push({
op: 'add_credit',
credit: credit,
message: message
});
if(this.settings.showFeedbackIcon) {
this.markingFeedback.push({
op: 'add_credit',
credit: credit,
message: message
});
}
},
/** Subtract an absolute value from `credit`
* @param {Number} credit - amount to subtract
@@ -1020,11 +1024,13 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
subCredit: function(credit,message)
{
this.credit -= credit;
this.markingFeedback.push({
op: 'sub_credit',
credit: credit,
message: message
});
if(this.settings.showFeedbackIcon) {
this.markingFeedback.push({
op: 'sub_credit',
credit: credit,
message: message
});
}
},
/** Multiply `credit` by the given amount - use to apply penalties
* @param {Number} factor
@@ -1034,12 +1040,14 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
{
var oCredit = this.credit
this.credit *= factor;
this.markingFeedback.push({
op: 'multiply_credit',
credit: this.credit - oCredit,
factor: factor,
message: message
});
if(this.settings.showFeedbackIcon) {
this.markingFeedback.push({
op: 'multiply_credit',
credit: this.credit - oCredit,
factor: factor,
message: message
});
}
},
/** Add a comment to the marking feedback
* @param {String} message
@@ -623,6 +623,7 @@ table {

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

.part .feedbackMessages {

0 comments on commit f92e4c8

Please sign in to comment.
You can’t perform that action at this time.