Picture of Niall Deighan
MCQ answer options
by Niall Deighan - Tuesday, 12 May 2015, 1:31 PM
 

Hi everyone. I recently had a colleague ask me about the answer options for an MCQ. While building a course he inserted a multiple choice question and set it to have multiple chances to answer it - "_attempts":2,
When testing the feedback section of the MCQ he discovered that "incorrect.notFinal" option did not appear if the first attempt was incorrect. On further tests he confirmed that the "partlyCorrect.notFinal" was functioning on multiple answer questions.

After doing a little digging I traced the root of this issue back to the questionView.js. The "getOptionSpecificFeedback" function doesn't account for multiple choice / multiple attempts feedback, the "_incorrect.notFinal" value from the components.json. So I crammed another if/else into the function, voila problem solved.

getOptionSpecificFeedback: function() {
  // Check if option specific feedback has been set
  var selectedItem = this.getSelectedItems();
  if (selectedItem.hasOwnProperty('_feedback')) { 
      return selectedItem._feedback;
  } else {
      if (this.isCorrect()) {
         return this.model.get('_feedback').correct;
      } else if (this.isPartlyCorrect()) {
         return this.model.get('_feedback')._partlyCorrect.final;
      } else if (this.model.get('_attemptsLeft') !== 0){
         return this.model.get('_feedback')._incorrect.notFinal;
      } else {
         return this.model.get('_feedback')._incorrect.final;
      }
    }
  },

Hope this helps.

Niall

Picture of Helen Bailey
Re: MCQ answer options
by Helen Bailey - Tuesday, 12 May 2015, 1:54 PM
 

Wow great work Niall thank you for posting this!  I'll try that.