diff --git a/js/dragquestion.js b/js/dragquestion.js index 241f3db5..c37040a5 100644 --- a/js/dragquestion.js +++ b/js/dragquestion.js @@ -25,6 +25,7 @@ H5P.DragQuestion = (function ($) { correct: 'Show solution', tryAgain: 'Retry', feedback: 'You got @score of @total points', + incorrectFeedback: 'You got @score of @total points', question: { settings: { questionTitle: 'Drag and drop', @@ -669,14 +670,21 @@ H5P.DragQuestion = (function ($) { }; /** - * Shows the score to the user when the score button i pressed. + * Shows the score to the user when the score button is pressed. + * Show (in)correct feedback depending on the points scored */ C.prototype.showScore = function () { var maxScore = this.calculateMaxScore(); if (this.options.behaviour.singlePoint) { maxScore = 1; } - var scoreText = this.options.feedback.replace('@score', this.points).replace('@total', maxScore); + var scoreText; + if (this.points == maxScore) { + scoreText = this.options.feedback.replace('@score', this.points).replace('@total', maxScore); + } + else { + scoreText = this.options.incorrectFeedback.replace('@score', this.points).replace('@total', maxScore); + } this.setFeedback(scoreText, this.points, maxScore); }; diff --git a/library.json b/library.json index fb4bbf9c..50efae0c 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "contentType": "Question", "majorVersion": 1, "minorVersion": 6, - "patchVersion": 2, + "patchVersion": 3, "embedTypes": [ "iframe" ], diff --git a/semantics.json b/semantics.json index 4f39689e..8cc74279 100644 --- a/semantics.json +++ b/semantics.json @@ -21,14 +21,6 @@ "default": "Show solution", "common": true }, - { - "label": "Feedback text", - "name": "feedback", - "type": "text", - "default": "You got @score of @total points", - "description": "Feedback text, variables available: @score and @total. Example: 'You got @score of @total points.'", - "common": true - }, { "name": "question", "type": "group", @@ -244,6 +236,20 @@ } ] }, + { + "label": "Correct feedback text", + "name": "feedback", + "type": "text", + "default": "You got @score of @total points", + "description": "Feedback text when correct answer is given, variables available: @score and @total. Example: 'You got @score of @total points.'" + }, + { + "label": "Incorrect feedback text", + "name": "incorrectFeedback", + "type": "text", + "default": "You got @score of @total points", + "description": "Feedback text when incorrect answer is given, variables available: @score and @total.'" + }, { "name": "backgroundOpacity", "type": "text",