From 77d993b44e7d4b4e0e025ed78658f8674fe362f6 Mon Sep 17 00:00:00 2001 From: Sergey Yuhnevich Date: Sat, 8 Oct 2016 11:01:12 +0300 Subject: [PATCH] add-ability-to-randomize-questions --- js/questionset.js | 2 ++ library.json | 5 +++++ semantics.json | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/js/questionset.js b/js/questionset.js index cd9727a..6a05ff6 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -20,6 +20,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { var self = this; this.contentId = contentId; + H5P.Randomize(options, 'questions'); + var texttemplate = '<% if (introPage.showIntroPage) { %>' + '
' + diff --git a/library.json b/library.json index 232a3be..23f96d6 100644 --- a/library.json +++ b/library.json @@ -38,6 +38,11 @@ "majorVersion": 4, "minorVersion": 5 }, + { + "machineName": "H5P.Randomize", + "majorVersion": 1, + "minorVersion": 0 + }, { "machineName": "H5P.Video", "majorVersion": 1, diff --git a/semantics.json b/semantics.json index 91ab898..c58210e 100644 --- a/semantics.json +++ b/semantics.json @@ -119,6 +119,22 @@ ] } }, + { + "name": "randomizeQuestions", + "type": "boolean", + "label": "Randomize questions", + "description": "Show questions to the user in random order.", + "default": false + }, + { + "name": "randomQuestionsAmount", + "type": "number", + "label": "Random questions amount", + "description": "Amount of questions that will be shown to the user in random order. If it is empty all questions will be shown.", + "min": 1, + "step": 1, + "optional": true + }, { "name": "texts", "type": "group",