Picture of Rob Mausser
Multiple Choice Reset even when correct answer chosen
by Rob Mausser - Friday, 25 May 2018, 9:26 PM
 

I have a client who wants their students to have unlimited abilites to reset a mcq component in an assessment, but no one can ever find out what the correct answer is. That means no feedback, no correct answer etc.

 

Which is fine, but the reset itself presents a problem. 

 

If you get a question correct, reset is disabled. Well, nothing tells you that you got the mcq correct, but its pretty obvious and self evident once you catch on why you can't reset. 

 

How can I mod the mcq to allow for reset even after correct answer is chosen? Is it as simple as commenting out some code in the js that is seeing that the question is being correctly answered, and then disabling the reset button? 

 

They also need to be able to reset the question for real. Meaning if someone chooses the correct answer, they can still reset and choose the wrong answer after submitting. 

 

Thanks

Picture of Matt Leathes
Re: Multiple Choice Reset even when correct answer chosen
by Matt Leathes - Wednesday, 30 May 2018, 10:27 AM
 

It is possible but will involve hacking around in the core code a bit. If you're OK with that I can provide instructions.

Alternatively, if the question is in an assessment, maybe allowing the user to reset the assessment even after they have passed it might work? This functionality was just released as part of Assessment v2.2.0

Picture of Rob Mausser
Re: Multiple Choice Reset even when correct answer chosen
by Rob Mausser - Wednesday, 18 July 2018, 6:49 PM
 

Hey Matt

 

We need the reset to work on each question induvidually. I'm more than Ok with hacking the code, as I already have quite a bit to get this working as per client expectations.

 

Some instructions would be more than great if you could provide some.

 

Thanks!

Picture of Matt Leathes
Re: Multiple Choice Reset even when correct answer chosen
by Matt Leathes - Thursday, 19 July 2018, 2:23 PM
 

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

Picture of Rob Mausser
Re: Multiple Choice Reset even when correct answer chosen
by Rob Mausser - Friday, 20 July 2018, 8:00 PM
 

Hey thanks so much for this!

 

Unfortunately, it seems to partially have an effect but not work completely. 

 

What happens is that when you select the correct answer the button at the bottom becomes clickable, but its still set to "Submit" and not reset. So you are unable to reset the question. 

 

Upon selecting the correct answer I get this console error

 

"

Uncaught TypeError: Cannot read property 'asString' of undefined
at n.onButtonStateChanged (adapt.min.js:3)
at _ (backbone.min.js:2)
at m (backbone.min.js:2)
at f (backbone.min.js:2)
at n.u.trigger (backbone.min.js:2)
at n.set (backbone.min.js:2)
at n.set (adapt.min.js:1)
at n.updateButtons (adapt.min.js:1)
at n._runModelCompatibleFunction (adapt.min.js:3)
at n.onSubmitClicked (adapt.min.js:3)
onButtonStateChanged @ adapt.min.js:3
_ @ backbone.min.js:2
m @ backbone.min.js:2
f @ backbone.min.js:2
u.trigger @ backbone.min.js:2
set @ backbone.min.js:2
set @ adapt.min.js:1
updateButtons @ adapt.min.js:1
_runModelCompatibleFunction @ adapt.min.js:3
onSubmitClicked @ adapt.min.js:3
onButtonStateUpdate @ adapt.min.js:3
_ @ backbone.min.js:2
m @ backbone.min.js:2
f @ backbone.min.js:2
u.trigger @ backbone.min.js:2
onActionClicked @ adapt.min.js:3
N @ underscore.min.js:5
(anonymous) @ underscore.min.js:5
(anonymous) @ underscore.min.js:5
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
adapt.min.js:7 SCORM.data.set('cmi.suspend_data') value:"

 

Any thoughts?

Picture of Rob Mausser
Re: Multiple Choice Reset even when correct answer chosen
by Rob Mausser - Friday, 20 July 2018, 8:35 PM
 

I fixed it simply by using 

 

this.set('_buttonState', BUTTON_STATE.RESET);

 

Instead of

 

this.set('_buttonState', this.get('_allowResetAfterCorrect') ? 'reset' : 'correct');

 

 

This will make every question resettable on correct but thats fine. 

Picture of Oliver Foster
Re: Multiple Choice Reset even when correct answer chosen
by Oliver Foster - Monday, 23 July 2018, 8:37 AM
 

Did you change this line in some Adapt Learning code? Is it something we need to fix?
Or is it a consequence of the previous changes you made in your copy?

Picture of Matt Leathes
Re: Multiple Choice Reset even when correct answer chosen
by Matt Leathes - Monday, 23 July 2018, 2:04 PM
 
Did you change this line in some Adapt Learning code? Is it something we need to fix? Or is it a consequence of the previous changes you made in your copy?

If you read the whole thread all should become clear... ;-)

Picture of Barry Jenkin
Re: Multiple Choice Reset even when correct answer chosen
by Barry Jenkin - Monday, 30 July 2018, 4:47 AM
 

Yay - been craving this option a while now. Thanks for sharing!

I've got it working although just globally in a course. I wasn't able to turn it on/off per quiz component. If there's a way please let me know.  When I tried _allowResetAfterCorrect = 'true' or 'false' it was being overridden (every quiz was displaying a Reset button on correct answer selected).

I'm finding that it's great for situational/scenario-based quizzes where there are no strict right/wrong answers and where it's useful for the learner to see feedbacks for alternative answers.

Picture of Matt Leathes
Re: Multiple Choice Reset even when correct answer chosen
by Matt Leathes - Monday, 30 July 2018, 9:06 AM
 

if you're putting this.set('_buttonState', BUTTON_STATE.RESET); as per Rob's post you need to change it to this.set('_buttonState', this.get('_allowResetAfterCorrect') ? BUTTON_STATE.RESET : BUTTON_STATE.CORRECT);

Picture of Barry Jenkin
Re: Multiple Choice Reset even when correct answer chosen
by Barry Jenkin - Wednesday, 1 August 2018, 4:13 AM
 

Thanks Matt - this works now, although it's interfering a little with my page level progress. I'm now completing the page with the quizzes at 95% whereas previously it was 100% when reset was disabled on correct answer.

I haven't actually enabled page level progress on these quiz components (perhaps a separate issue).

Picture of K Edison
Re: Multiple Choice Reset even when correct answer chosen
by K Edison - Wednesday, 26 July 2023, 6:57 PM
 

Hi Barry, were you eventually able to get this to work?

Picture of K Edison
Re: Multiple Choice Reset even when correct answer chosen
by K Edison - Wednesday, 26 July 2023, 6:58 PM
 

Hi Matt, have you tried doing this in the newer framework? I am unable to get it to work properly.