From e941f693cd0a5b80868245d405337c6520d31644 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 2 Sep 2021 14:56:11 +0200 Subject: [PATCH] JI-2533 QS implement 'getContext()' (#81) Co-authored-by: Ravi Majithia --- js/questionset.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/questionset.js b/js/questionset.js index 267f8d5..ce859a0 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -1240,6 +1240,18 @@ H5P.QuestionSet = function (options, contentId, contentData) { children: getXAPIDataFromChildren(this) }; }; + + /** + * Get context data. + * Contract used for confusion report. + */ + this.getContext = function () { + // Get question index and add 1, count starts from 0 + return { + type: 'question', + value: (currentQuestion + 1) + }; + }; }; H5P.QuestionSet.prototype = Object.create(H5P.EventDispatcher.prototype);