Skip to content
Permalink
Browse files

better feedback when 0 marks available

If a gapfill is worth no marks, each gap is worth 1/(num gaps) credit,
rather than dividing by 0 and getting NaN credit.

Use the change in credit to decide on feedback icon, not change in
marks. Again, this matters when 0 marks available.
  • Loading branch information...
christianp committed Sep 4, 2018
1 parent ed79a3f commit 8be94e0bc85aca7d01d1b0bc02d55108d281e05e
Showing with 7 additions and 4 deletions.
  1. +1 −1 marking_scripts/gapfill.jme
  2. +1 −1 runtime/scripts/part.js
  3. +5 −2 themes/default/files/scripts/part-display.js
@@ -30,7 +30,7 @@ gap_feedback (Feedback on each of the gaps):
map(
let(result,submit_part(gaps[gap_number]["path"],answer),
feedback(translate('part.gapfill.feedback header',["index":index]));
concat_feedback(result["feedback"], result["marks"]/marks);
concat_feedback(result["feedback"], if(marks>0,result["marks"]/marks,1));
result
),
[gap_number,answer,index],
@@ -689,7 +689,7 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
this.question && this.question.updateScore();
if(this.answered)
{
if(!(this.parentPart && this.parentPart.type=='gapfill') && this.settings.showFeedbackIcon) {
if(!(this.parentPart && this.parentPart.type=='gapfill') && this.settings.showFeedbackIcon && this.marks!=0) {
this.markingComment(
R('part.marking.total score',{count:this.score})
);
@@ -291,8 +291,11 @@ Numbas.queueScript('part-display',['display-base','util'],function() {
{
var action = this.part.markingFeedback[i];
var change = action.credit*maxMarks;
if(action.gap!=undefined)
var credit_change = action.credit;
if(action.gap!=undefined) {
change *= this.part.gaps[action.gap].marks/this.part.marks;
credit_change *= this.part.marks>0 ? this.part.gaps[action.gap].marks/this.part.marks : 1/this.part.gaps.length;
}
t += change;
var message = action.message || '';
if(util.isNonemptyHTML(message))
@@ -303,7 +306,7 @@ Numbas.queueScript('part-display',['display-base','util'],function() {
else if(change<0)
message+='\n\n'+R('feedback.taken away',{count:marks});
}
var change_desc = change>0 ? 'positive' : change<0 ? 'negative' : 'neutral';
var change_desc = credit_change>0 ? 'positive' : credit_change<0 ? 'negative' : 'neutral';
switch(action.reason) {
case 'correct':
change_desc = 'positive';

0 comments on commit 8be94e0

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