From 9401e5abe33faf4e38d58594fcaf2b92e593307c Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 3 Jul 2017 15:09:49 +0200 Subject: [PATCH 1/7] Added overall feedback to question set + bonus fixes [HFP-1174] --- css/questionset.css | 17 ++++------ js/questionset.js | 27 +++++++-------- library.json | 9 +++-- semantics.json | 82 +++++++++++++++++++++++++++++++++++---------- upgrades.js | 26 ++++++++++++++ 5 files changed, 116 insertions(+), 45 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index f9dc83a..a9eb1fc 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -225,30 +225,27 @@ font-size: 1.25em; } -.questionset-results .feedback-section .feedback-text { - font-weight: normal; - color: #777; -} - .questionset-results .buttons { - margin-bottom: 1.5em; + margin: 2em 0 1em 0; } .questionset-results .result-header, -.questionset-results .result-text { +.questionset-results .result-text, +.questionset-results .feedback-section .feedback-text { color: #1a73d9; font-weight: bold; } .questionset-results .result-header { font-size: 2em; - margin-top: 1em; + margin: 1em 0.5em 0.5em 0.5em; } -.questionset-results .result-text { +.questionset-results .result-text, +.questionset-results .feedback-section .feedback-text { font-size: 1.25em; line-height: 1.25em; - margin: 1em 1em 2.25em; + margin: 1em; } /* No margin for questions when no frame */ diff --git a/js/questionset.js b/js/questionset.js index d4bc904..6bd0b21 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -112,11 +112,11 @@ H5P.QuestionSet = function (options, contentId, contentData) { showResultPage: true, noResultMessage: 'Finished', message: 'Your result:', - successGreeting: 'Congratulations!', - successComment: 'You have enough correct answers to pass the test.', - failGreeting: 'Sorry!', - failComment: "You don't have enough correct answers to pass this test.", - scoreString: 'You got @score of @total points', + successGreeting: '', + successComment: '', + failGreeting: '', + failComment: '', + overallFeedback: [], finishButtonText: 'Finish', solutionButtonText: 'Show solution', retryButtonText: 'Retry', @@ -420,13 +420,17 @@ H5P.QuestionSet = function (options, contentId, contentData) { var hasAutoPlay = currentQuestion && currentQuestion.params.media + && currentQuestion.params.media.params + && currentQuestion.params.media.params.playback && currentQuestion.params.media.params.playback.autoplay; - if (hasAutoPlay) { + if (hasAutoPlay && typeof questionInstances[currentQuestionIndex].play === 'function') { questionInstances[currentQuestionIndex].play(); } }; + + /** * Show solutions for subcontent, and hide subcontent buttons. * Used for contracts with integrated content. @@ -703,12 +707,9 @@ H5P.QuestionSet = function (options, contentId, contentData) { // Get total score. var finals = self.getScore(); var totals = self.getMaxScore(); - var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals); + + var scoreString = H5P.Question.determineOverallFeedback(params.endGame.overallFeedback, finals / totals).replace('@score', finals).replace('@total', totals); var success = ((100 * finals / totals) >= params.passPercentage); - var eventData = { - score: scoreString, - passed: success - }; /** * Makes our buttons behave like other buttons. @@ -743,10 +744,6 @@ H5P.QuestionSet = function (options, contentId, contentData) { $myDom.append(endTemplate.render(eparams)); if (params.endGame.showResultPage) { - // Add event handlers to summary buttons - hookUpButton('.qs-finishbutton', function () { - self.trigger('h5pQuestionSetFinished', eventData); - }); hookUpButton('.qs-solutionbutton', function () { showSolutions(); $myDom.children().hide().filter('.questionset').show(); diff --git a/library.json b/library.json index 3fb82a0..0c46467 100644 --- a/library.json +++ b/library.json @@ -14,7 +14,7 @@ "author": "Joubel", "coreApi": { "majorVersion": 1, - "minorVersion": 6 + "minorVersion": 14 }, "license": "MIT", "preloadedJs": [ @@ -50,6 +50,11 @@ } ], "editorDependencies": [ + { + "machineName": "H5PEditor.RangeList", + "majorVersion": 1, + "minorVersion": 0 + }, { "machineName": "H5PEditor.VerticalTabs", "majorVersion": 1, @@ -61,4 +66,4 @@ "minorVersion": 2 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index 7268972..3eb6e3c 100644 --- a/semantics.json +++ b/semantics.json @@ -122,7 +122,7 @@ "description": "Library for this question.", "options": [ "H5P.MultiChoice 1.9", - "H5P.DragQuestion 1.10", + "H5P.DragQuestion 1.11", "H5P.Blanks 1.7", "H5P.MarkTheWords 1.6", "H5P.DragText 1.5", @@ -276,7 +276,6 @@ "label": "Feedback heading", "importance": "low", "default": "Your result:", - "optional": true, "description": "This heading will be displayed at the end of the quiz when the user has answered all questions.", "tags": [ "strong", @@ -284,27 +283,74 @@ ] }, { - "name": "scoreString", - "type": "text", - "label": "Score display text", + "name": "overallFeedback", + "type": "group", + "label": "Overall Feedback", "importance": "low", - "description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ", - "default": "You got @score of @total points", - "optional": true + "fields": [ + { + "name": "overallFeedback", + "type": "list", + "widgets": [ + { + "name": "RangeList", + "label": "Default" + } + ], + "importance": "high", + "label": "Define custom feedback for any score range", + "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", + "entity": "range", + "min": 1, + "defaultNum": 1, + "optional": true, + "field": { + "name": "overallFeedback", + "type": "group", + "importance": "low", + "fields": [ + { + "name": "from", + "type": "number", + "label": "Score Range", + "min": 0, + "max": 100, + "default": 0, + "unit": "%" + }, + { + "name": "to", + "type": "number", + "min": 0, + "max": 100, + "default": 100, + "unit": "%" + }, + { + "name": "feedback", + "type": "text", + "label": "Feedback for defined score range", + "importance": "low", + "placeholder": "Fill in the feedback", + "optional": true + } + ] + } + } + ] }, { "name": "successGreeting", "type": "text", "label": "Quiz passed greeting", "importance": "low", - "placeholder": "Congratulations!", - "default": "Congratulations!", "optional": true, "description": "This text will be displayed above the score if the user has successfully passed the quiz.", "tags": [ "strong", "em" - ] + ], + "deprecated": true }, { "name": "successComment", @@ -312,7 +358,6 @@ "widget": "html", "label": "Passed comment", "importance": "low", - "default": "You did very well!", "optional": true, "description": "This comment will be displayed after the score if the user has successfully passed the quiz.", "tags": [ @@ -322,20 +367,21 @@ "em", "a", "p" - ] + ], + "deprecated": true }, { "name": "failGreeting", "type": "text", "label": "Quiz failed title", "importance": "low", - "default": "You did not pass this time.", "optional": true, "description": "This text will be displayed above the score if the user has failed the quiz.", "tags": [ "strong", "em" - ] + ], + "deprecated": true }, { "name": "failComment", @@ -343,7 +389,6 @@ "widget": "html", "label": "Failed comment", "importance": "low", - "default": "Have another try!", "optional": true, "description": "This comment will be displayed after the score if the user has failed the quiz.", "tags": [ @@ -353,7 +398,8 @@ "em", "a", "p" - ] + ], + "deprecated": true }, { "name": "solutionButtonText", @@ -460,4 +506,4 @@ } ] } -] \ No newline at end of file +] diff --git a/upgrades.js b/upgrades.js index dc41328..bf86aea 100644 --- a/upgrades.js +++ b/upgrades.js @@ -52,6 +52,32 @@ H5PUpgrades['H5P.QuestionSet'] = (function ($) { // Remove old copyright dialog question label delete parameters.questionLabel; + finished(null, parameters); + }, + + /** + * Asynchronous content upgrade hook. + * + * Upgrade params to support overall feedback + * + * @param {Object} parameters + * @param {function} finished + */ + 13: function (parameters, finished) { + + parameters.endGame = parameters.endGame || {}; + parameters.endGame.overallFeedback = []; + + if (parameters.endGame.scoreString) { + parameters.endGame.overallFeedback.push({ + from: 0, + to: 100, + feedback: parameters.endGame.scoreString + }); + + delete parameters.endGame.scoreString; + } + finished(null, parameters); } } From acb9da13ee9157dae7e25ae2280c28ce995f5252 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Tue, 4 Jul 2017 08:30:52 +0200 Subject: [PATCH 2/7] Updated english source file [HFP-1174] --- language/.en.json | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/language/.en.json b/language/.en.json index c59f34f..242a8bf 100644 --- a/language/.en.json +++ b/language/.en.json @@ -141,29 +141,43 @@ "description": "This heading will be displayed at the end of the quiz when the user has answered all questions." }, { - "label": "Score display text", - "description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ", - "default": "You got @score of @total points" + "label": "Overall Feedback", + "fields": [ + { + "widgets": [], + "label": "Define custom feedback for any score range", + "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", + "entity": "range", + "field": { + "fields": [ + { + "label": "Score Range" + }, + { + }, + { + "label": "Feedback for defined score range", + "placeholder": "Fill in the feedback" + } + ] + } + } + ] }, { "label": "Quiz passed greeting", - "placeholder": "Congratulations!", - "default": "Congratulations!", "description": "This text will be displayed above the score if the user has successfully passed the quiz." }, { "label": "Passed comment", - "default": "You did very well!", "description": "This comment will be displayed after the score if the user has successfully passed the quiz." }, { "label": "Quiz failed title", - "default": "You did not pass this time.", "description": "This text will be displayed above the score if the user has failed the quiz." }, { "label": "Failed comment", - "default": "Have another try!", "description": "This comment will be displayed after the score if the user has failed the quiz." }, { @@ -230,4 +244,4 @@ ] } ] -} \ No newline at end of file +} From 63e95b71522284f0779731114a69fd63820139fa Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Tue, 4 Jul 2017 13:12:11 +0200 Subject: [PATCH 3/7] Setting up default feedback for overall feedback [HFP-1174] --- semantics.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/semantics.json b/semantics.json index 3eb6e3c..b6db4ee 100644 --- a/semantics.json +++ b/semantics.json @@ -299,7 +299,7 @@ ], "importance": "high", "label": "Define custom feedback for any score range", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", + "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!\n\"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score.", "entity": "range", "min": 1, "defaultNum": 1, @@ -332,6 +332,8 @@ "label": "Feedback for defined score range", "importance": "low", "placeholder": "Fill in the feedback", + "default": "You got @score of @total points", + "showDefaultOnFirstRow": true, "optional": true } ] From 7aad2428915fcd48d2d0a45bdd55d2ea5ffd17ca Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 13 Jul 2017 15:19:37 +0200 Subject: [PATCH 4/7] Remove default feedback HFP-1174 --- semantics.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/semantics.json b/semantics.json index b6db4ee..2720be7 100644 --- a/semantics.json +++ b/semantics.json @@ -332,8 +332,6 @@ "label": "Feedback for defined score range", "importance": "low", "placeholder": "Fill in the feedback", - "default": "You got @score of @total points", - "showDefaultOnFirstRow": true, "optional": true } ] From 6a762b8223c64b2187e24e8c2c802b172f8538b6 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 13 Jul 2017 15:51:24 +0200 Subject: [PATCH 5/7] Move old feedback into a separate deprecated group HFP-1174 --- js/questionset.js | 80 +++++++++++++++--------------- language/.en.json | 36 ++++++++------ library.json | 2 +- semantics.json | 123 ++++++++++++++++++++++++---------------------- upgrades.js | 20 ++++++++ 5 files changed, 146 insertions(+), 115 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 6bd0b21..8518a7d 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -112,10 +112,12 @@ H5P.QuestionSet = function (options, contentId, contentData) { showResultPage: true, noResultMessage: 'Finished', message: 'Your result:', - successGreeting: '', - successComment: '', - failGreeting: '', - failComment: '', + oldFeedback: { + successGreeting: '', + successComment: '', + failGreeting: '', + failComment: '' + }, overallFeedback: [], finishButtonText: 'Finish', solutionButtonText: 'Show solution', @@ -158,27 +160,27 @@ H5P.QuestionSet = function (options, contentId, contentData) { var randomizeQuestionOrdering = function (questions) { // Save the original order of the questions in a multidimensional array [[question0,0],[question1,1]... - var questionOrdering = questions.map(function(questionInstance, index) { return [questionInstance, index] }); + var questionOrdering = questions.map(function (questionInstance, index) { return [questionInstance, index]; }); // Shuffle the multidimensional array questionOrdering = H5P.shuffleArray(questionOrdering); // Retrieve question objects from the first index - var questions = []; + questions = []; for (var i = 0; i < questionOrdering.length; i++) { questions[i] = questionOrdering[i][0]; } // Retrieve the new shuffled order from the second index var newOrder = []; - for (var i = 0; i< questionOrdering.length; i++) { + for (var j = 0; j < questionOrdering.length; j++) { // Use a previous order if it exists - if(contentData.previousState && contentData.previousState.questionOrder) { - newOrder[i] = questionOrder[questionOrdering[i][1]]; + if (contentData.previousState && contentData.previousState.questionOrder) { + newOrder[j] = questionOrder[questionOrdering[j][1]]; } else { - newOrder[i] = questionOrdering[i][1]; + newOrder[j] = questionOrdering[j][1]; } } @@ -193,7 +195,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { if (params.poolSize > 0) { // If a previous pool exists, recreate it - if(contentData.previousState && contentData.previousState.poolOrder) { + if (contentData.previousState && contentData.previousState.poolOrder) { poolOrder = contentData.previousState.poolOrder; // Recreate the pool from the saved data @@ -247,7 +249,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { * @param {object} questions H5P content types to be created as instances * @return {array} Array of questions instances */ - var createQuestionInstancesFromQuestions = function(questions) { + var createQuestionInstancesFromQuestions = function (questions) { var result = []; // Create question instances from questions // Instantiate question instances @@ -312,8 +314,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { var _updateButtons = function () { // Verify that current question is answered when backward nav is disabled if (params.disableBackwardsNavigation) { - if (questionInstances[currentQuestion].getAnswerGiven() - && questionInstances.length-1 !== currentQuestion) { + if (questionInstances[currentQuestion].getAnswerGiven() && + questionInstances.length-1 !== currentQuestion) { questionInstances[currentQuestion].showButton('next'); } else { @@ -418,11 +420,11 @@ H5P.QuestionSet = function (options, contentId, contentData) { var currentQuestion = params.questions[currentQuestionIndex]; - var hasAutoPlay = currentQuestion - && currentQuestion.params.media - && currentQuestion.params.media.params - && currentQuestion.params.media.params.playback - && currentQuestion.params.media.params.playback.autoplay; + var hasAutoPlay = currentQuestion && + currentQuestion.params.media && + currentQuestion.params.media.params && + currentQuestion.params.media.params.playback && + currentQuestion.params.media.params.playback.autoplay; if (hasAutoPlay && typeof questionInstances[currentQuestionIndex].play === 'function') { questionInstances[currentQuestionIndex].play(); @@ -524,7 +526,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { //Force the last page to be reRendered rendered = false; - if(params.poolSize > 0){ + if (params.poolSize > 0) { // Make new pool from params.questions // Randomize and get the results @@ -577,7 +579,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { var replaceQuestionsInDOM = function (questionInstances) { // Find all question containers and detach questions from them - $('.question-container', $myDom).each(function (){ + $('.question-container', $myDom).each(function () { $(this).children().detach(); }); @@ -592,19 +594,19 @@ H5P.QuestionSet = function (options, contentId, contentData) { question.attach($('.question-container:eq(' + i + ')', $myDom)); //Show buttons if necessary - if(questionInstances[questionInstances.length -1] === question - && question.hasButton('finish')) { + if (questionInstances[questionInstances.length -1] === question && + question.hasButton('finish')) { question.showButton('finish'); } - if(questionInstances[questionInstances.length -1] !== question - && question.hasButton('next')) { + if (questionInstances[questionInstances.length -1] !== question && + question.hasButton('next')) { question.showButton('next'); } - if(questionInstances[0] !== question - && question.hasButton('prev') - && !params.disableBackwardsNavigation) { + if (questionInstances[0] !== question && + question.hasButton('prev') && + !params.disableBackwardsNavigation) { question.showButton('prev'); } @@ -645,7 +647,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { * @param {number} dotIndex Index of dot * @param {boolean} isAnswered True if is answered, False if not answered */ - var toggleAnsweredDot = function(dotIndex, isAnswered) { + var toggleAnsweredDot = function (dotIndex, isAnswered) { var $el = $('.progress-dot:eq(' + dotIndex +')', $myDom); // Skip current button @@ -732,8 +734,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { var eparams = { message: params.endGame.showResultPage ? params.endGame.message : params.endGame.noResultMessage, - comment: params.endGame.showResultPage ? (success ? params.endGame.successGreeting : params.endGame.failGreeting) : undefined, - resulttext: params.endGame.showResultPage ? (success ? params.endGame.successComment : params.endGame.failComment) : undefined, + comment: params.endGame.showResultPage ? (success ? params.endGame.oldFeedback.successGreeting : params.endGame.oldFeedback.failGreeting) : undefined, + resulttext: params.endGame.showResultPage ? (success ? params.endGame.oldFeedback.successComment : params.endGame.oldFeedback.failComment) : undefined, finishButtonText: params.endGame.finishButtonText, solutionButtonText: params.endGame.solutionButtonText, retryButtonText: params.endGame.retryButtonText @@ -873,7 +875,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { }); // Hide next button if it is the last question - if(questionInstances[questionInstances.length -1] === question) { + if (questionInstances[questionInstances.length -1] === question) { question.hideButton('next'); } @@ -1101,10 +1103,10 @@ H5P.QuestionSet = function (options, contentId, contentData) { return info; }; - this.getQuestions = function() { + this.getQuestions = function () { return questionInstances; }; - this.showSolutions = function() { + this.showSolutions = function () { renderSolutions = true; }; @@ -1162,7 +1164,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { /** * Add the question itself to the definition part of an xAPIEvent */ - var addQuestionToXAPI = function(xAPIEvent) { + var addQuestionToXAPI = function (xAPIEvent) { var definition = xAPIEvent.getVerifiedStatementValue(['object', 'definition']); $.extend(definition, getxAPIDefinition()); }; @@ -1173,8 +1175,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { * @param {Object} metaContentType * @returns {array} */ - var getXAPIDataFromChildren = function(metaContentType) { - return metaContentType.getQuestions().map(function(question) { + var getXAPIDataFromChildren = function (metaContentType) { + return metaContentType.getQuestions().map(function (question) { return question.getXAPIData(); }); }; @@ -1185,7 +1187,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { * * @see contract at {@link https://h5p.org/documentation/developers/contracts#guides-header-6} */ - this.getXAPIData = function(){ + this.getXAPIData = function () { var xAPIEvent = this.createXAPIEventTemplate('answered'); addQuestionToXAPI(xAPIEvent); xAPIEvent.setScoredResult(this.getScore(), @@ -1197,7 +1199,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { return { statement: xAPIEvent.data.statement, children: getXAPIDataFromChildren(this) - } + }; }; }; diff --git a/language/.en.json b/language/.en.json index 242a8bf..5dbdf69 100644 --- a/language/.en.json +++ b/language/.en.json @@ -153,8 +153,7 @@ { "label": "Score Range" }, - { - }, + {}, { "label": "Feedback for defined score range", "placeholder": "Fill in the feedback" @@ -165,20 +164,25 @@ ] }, { - "label": "Quiz passed greeting", - "description": "This text will be displayed above the score if the user has successfully passed the quiz." - }, - { - "label": "Passed comment", - "description": "This comment will be displayed after the score if the user has successfully passed the quiz." - }, - { - "label": "Quiz failed title", - "description": "This text will be displayed above the score if the user has failed the quiz." - }, - { - "label": "Failed comment", - "description": "This comment will be displayed after the score if the user has failed the quiz." + "label": "Old Feedback", + "fields": [ + { + "label": "Quiz passed greeting", + "description": "This text will be displayed above the score if the user has successfully passed the quiz." + }, + { + "label": "Passed comment", + "description": "This comment will be displayed after the score if the user has successfully passed the quiz." + }, + { + "label": "Quiz failed title", + "description": "This text will be displayed above the score if the user has failed the quiz." + }, + { + "label": "Failed comment", + "description": "This comment will be displayed after the score if the user has failed the quiz." + } + ] }, { "label": "Solution button label", diff --git a/library.json b/library.json index 95fe57e..3177ecf 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "description": "Put together a set of different questions that has to be solved. (Quiz)", "contentType": "question", "majorVersion": 1, - "minorVersion": 15, + "minorVersion": 13, "patchVersion": 0, "embedTypes": [ "iframe" diff --git a/semantics.json b/semantics.json index 33d59eb..9a8e860 100644 --- a/semantics.json +++ b/semantics.json @@ -340,66 +340,71 @@ ] }, { - "name": "successGreeting", - "type": "text", - "label": "Quiz passed greeting", + "name": "oldFeedback", + "type": "group", + "label": "Old Feedback", "importance": "low", - "optional": true, - "description": "This text will be displayed above the score if the user has successfully passed the quiz.", - "tags": [ - "strong", - "em" - ], - "deprecated": true - }, - { - "name": "successComment", - "type": "text", - "widget": "html", - "label": "Passed comment", - "importance": "low", - "optional": true, - "description": "This comment will be displayed after the score if the user has successfully passed the quiz.", - "tags": [ - "sub", - "sup", - "strong", - "em", - "a", - "p" - ], - "deprecated": true - }, - { - "name": "failGreeting", - "type": "text", - "label": "Quiz failed title", - "importance": "low", - "optional": true, - "description": "This text will be displayed above the score if the user has failed the quiz.", - "tags": [ - "strong", - "em" - ], - "deprecated": true - }, - { - "name": "failComment", - "type": "text", - "widget": "html", - "label": "Failed comment", - "importance": "low", - "optional": true, - "description": "This comment will be displayed after the score if the user has failed the quiz.", - "tags": [ - "sub", - "sup", - "strong", - "em", - "a", - "p" - ], - "deprecated": true + "deprecated": true, + "fields": [ + { + "name": "successGreeting", + "type": "text", + "label": "Quiz passed greeting", + "importance": "low", + "optional": true, + "description": "This text will be displayed above the score if the user has successfully passed the quiz.", + "tags": [ + "strong", + "em" + ] + }, + { + "name": "successComment", + "type": "text", + "widget": "html", + "label": "Passed comment", + "importance": "low", + "optional": true, + "description": "This comment will be displayed after the score if the user has successfully passed the quiz.", + "tags": [ + "sub", + "sup", + "strong", + "em", + "a", + "p" + ] + }, + { + "name": "failGreeting", + "type": "text", + "label": "Quiz failed title", + "importance": "low", + "optional": true, + "description": "This text will be displayed above the score if the user has failed the quiz.", + "tags": [ + "strong", + "em" + ] + }, + { + "name": "failComment", + "type": "text", + "widget": "html", + "label": "Failed comment", + "importance": "low", + "optional": true, + "description": "This comment will be displayed after the score if the user has failed the quiz.", + "tags": [ + "sub", + "sup", + "strong", + "em", + "a", + "p" + ] + } + ] }, { "name": "solutionButtonText", diff --git a/upgrades.js b/upgrades.js index bf86aea..7829f31 100644 --- a/upgrades.js +++ b/upgrades.js @@ -78,6 +78,26 @@ H5PUpgrades['H5P.QuestionSet'] = (function ($) { delete parameters.endGame.scoreString; } + // Group old feedback fields + if (parameters.endGame.successGreeting || + parameters.endGame.successComment || + parameters.endGame.failGreeting || + parameters.endGame.failComment) { + parameters.endGame.oldFeedback = {}; + if (parameters.endGame.successGreeting) { + parameters.endGame.oldFeedback.successGreeting = parameters.endGame.successGreeting; + } + if (parameters.endGame.successComment) { + parameters.endGame.oldFeedback.successComment = parameters.endGame.successComment; + } + if (parameters.endGame.failGreeting) { + parameters.endGame.oldFeedback.failGreeting = parameters.endGame.failGreeting; + } + if (parameters.endGame.failComment) { + parameters.endGame.oldFeedback.failComment = parameters.endGame.failComment; + } + } + finished(null, parameters); } } From c76d0a89c124dcdbccb01710da5a17f653341621 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 13 Jul 2017 16:07:56 +0200 Subject: [PATCH 6/7] Update description HFP-1174 --- semantics.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semantics.json b/semantics.json index 9a8e860..0cbdbfa 100644 --- a/semantics.json +++ b/semantics.json @@ -299,7 +299,7 @@ ], "importance": "high", "label": "Define custom feedback for any score range", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!\n\"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score.", + "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!" "entity": "range", "min": 1, "defaultNum": 1, From 697720a06a2ffef86e817399a6d4fb6afac24a5d Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 13 Jul 2017 16:12:26 +0200 Subject: [PATCH 7/7] I messed up... --- semantics.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semantics.json b/semantics.json index 0cbdbfa..733e68e 100644 --- a/semantics.json +++ b/semantics.json @@ -299,7 +299,7 @@ ], "importance": "high", "label": "Define custom feedback for any score range", - "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!" + "description": "Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!", "entity": "range", "min": 1, "defaultNum": 1,