Permalink
Browse files

don't mark parent parts as dirty when step modified

The behaviour around submitting steps is quite hard to get my head
round. Submitting a step doesn't cause the parent part to be submitted -
that's correct, because they can be interacted with independently,
except that the total earned through steps affects the score awarded
for the parent.

However, until now, when a step is marked as dirty, i.e. the student has
changed their answer, the parent part was also marked dirty. That meant
that the score earned from steps wouldn't be shown until the parent part
was submitted.

This changes the behaviour, so steps don't set their parent parts as
dirty. When you just submit steps, and don't enter an answer to the
parent part, the score earned from steps is shown for the part, and "you
were awarded X marks for your answers to the steps" is the only entry in
the feedback.
  • Loading branch information...
christianp committed Jan 23, 2018
1 parent 8c796d4 commit b186bbba744ba6f90759817171895698dbb4d9cb
Showing with 4 additions and 3 deletions.
  1. +3 −2 runtime/scripts/part.js
  2. +1 −1 themes/default/files/scripts/display-base.js
@@ -619,6 +619,8 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {

if(this.parentPart && !this.parentPart.submitting)
this.parentPart.calculateScore();

this.display && this.display.showScore(this.answered);
},

/** Update the stored answer from the student (called when the student changes their answer, but before submitting)
@@ -638,7 +640,7 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
this.isDirty = dirty;
if(this.display) {
this.display && this.display.isDirty(dirty);
if(dirty && this.parentPart) {
if(dirty && this.parentPart && !this.isStep) {
this.parentPart.setDirty(true);
}
this.question && this.question.display && this.question.display.isDirty(this.question.isDirty());
@@ -754,7 +756,6 @@ Part.prototype = /** @lends Numbas.parts.Part.prototype */ {
}

this.store && this.store.partAnswered(this);
this.display && this.display.showScore(this.answered);

this.submitting = false;

@@ -265,7 +265,7 @@ var showScoreFeedback = display.showScoreFeedback = function(obj,settings)
var newScore = Knockout.observable(false);

var answered = Knockout.computed(function() {
return !obj.isDirty() && (obj.answered() || obj.score()>0);
return !obj.isDirty() && (obj.answered() || obj.credit()>0);
});

var state = Knockout.computed(function() {

0 comments on commit b186bbb

Please sign in to comment.