Detect if last question reached

Hello,

I'm currently developing a quiz app with H5P and I need a way to see if the question that I'm currently on is the last question in the set. For instance, I would like to display a special message when the user reaches the final question in the set but I can't find a way to differentiate the last question from any other question.

Using  "H5P.externalDispatcher.on('xAPI', function (event) {

  console.log(event.data.statement);

});"

I can't find anything that would identify a question as the last one. Is there a way to do this?

Thanks

tim's picture

Hi Goldeedore, 

Unfortunately, the current xapi statements produced by Question Set do not contain any information regarding progress.

However, since the code is open source, if you have the ability you can add the necessary code to get it working. This will involve checking the state of the question set and appending that data to the xapi statements that are currently being fired.

There is already some data stating the current question:
https://github.com/h5p/h5p-question-set/blob/master/js/questionset.js#L906

You would just need to compare this to the total number of questions to figure out if your learners are on the last one.