Skip to content

Commit 1ec6d12

Browse files
committed
when showing part feedback messages but not answer state, don't show positive or negative messages
1 parent 8687bb3 commit 1ec6d12

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

runtime/scripts/part.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ if(res) { \
17781778
}
17791779
}
17801780
}
1781-
change_desc = credit_change>0 ? 'positive' : credit_change<0 ? 'negative' : 'neutral';
1781+
change_desc = credit_change > 0 ? 'positive' : credit_change < 0 ? 'negative' : 'neutral';
17821782
switch(action.reason) {
17831783
case 'correct':
17841784
change_desc = 'positive';

themes/default/files/scripts/display-util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ Numbas.queueScript('display-util', ['math'], function() {
282282
state: state,
283283
showActualMark: showActualMark,
284284
showTotalMark: showTotalMark,
285+
showAnswerState: showAnswerState,
285286
answered: answered,
286287
answeredString: Knockout.computed(function() {
287288
if(obj.marks()==0 && !obj.doesMarking()) {

themes/default/files/scripts/part-display.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,23 @@ Numbas.queueScript('part-display',['display-util', 'display-base','util','jme'],
425425
*/
426426
this.shownFeedbackMessages = Knockout.computed(function() {
427427
var messages = this.feedbackMessages();
428+
429+
// If not showing part feedback messages, only show messages about invalid input.
428430
if(!this.showFeedbackMessages()) {
429431
messages = messages.filter(function(m) { return m.credit_change == 'invalid'; });
430432
}
433+
434+
// If not showing the answer correctness, don't show messages that give positive or negative feedback.
435+
if(!this.scoreFeedback.showAnswerState()) {
436+
messages = messages.filter(function(m) {
437+
return !(m.credit_change == 'positive' || m.credit_change == 'negative');
438+
});
439+
}
440+
441+
// If showing the current score and this part is marked, add a message giving the total score.
431442
if(feedback_settings.showFeedbackIcon && this.marks()!=0 && this.scoreFeedback.showActualMark()) {
432443
messages.push({
433-
credit_change: 0,
444+
credit_change: '',
434445
message: '',
435446
icon: undefined,
436447
credit_message: R('part.marking.total score',{count:p.score}),

0 commit comments

Comments
 (0)