Sure no problem. Last time I did this was for a course built in a relatively old version of Adapt (v2.0.15) but I think it should still work in later versions.
So, first of all in the function updateButtons
in questionModel.js, find the line this.set('_buttonState', BUTTON_STATE.CORRECT);
(it's here in the current version, in older versions you will find it says 'correct'
instead of BUTTON_STATE.CORRECT
)
Replace it with:
this.set('_buttonState', this.get('_allowResetAfterCorrect') ? 'reset' : 'correct');
(Note: it's a good idea to comment such changes to core code just in case you later have to pull down updates - or so someone else knows why you made them)
Next, in onResetClicked
in questionView.js find the line this.resetQuestion();
(it's here in the current code) and add this code just above it:
if(this.model.get('_isCorrect')) {
this.model.reset('soft', true);
}
This amend will reset the question for another attempt but not reset the completion of the question. If you do want it to reset completion, use 'hard'
instead of 'soft'
.
Next, you need get the radio/checkbox icons to show again after the question is reset - scroll down a bit to the function setQuestionAsReset
and change the line this.$(".component-widget").removeClass("submitted");
to:
this.$('.component-widget').removeClass('submitted').removeClass('show-user-answer');
Finally, amend the JSON for any question components you want to have this functionality to have a property _allowResetAfterCorrect
, set to true
.
If you want all question components to have this behaviour, just remove that condition check from the code you added in updateButtons
and you won't have to amend the JSON.
Hope this helps