-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #9 Added 'Incorrect feedback text' support #10
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -669,14 +669,19 @@ 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. | ||
* Modified by SUPRIYA RAJGOPAL on 1Sep16 to 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use H5P code style guidelines for if clauses, i.e. curly braces |
||
else | ||
scoreText = this.options.incorrect_feedback.replace('@score', this.points).replace('@total', maxScore); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. incorrect_feedback is undefined for old content. It needs a default value set in JS. see extended options |
||
this.setFeedback(scoreText, this.points, maxScore); | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,20 @@ | |
"common": true | ||
}, | ||
{ | ||
"label": "Feedback text", | ||
"label": "Correct 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 | ||
"description": "Feedback text when correct answer is given, variables available: @score and @total. Example: 'You got @score of @total points.'", | ||
"common": false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semantic common fields default to "false", there is no need to specify this. You can remove the "common": false line. |
||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New semantics must be added to all language files |
||
"label": "Incorrect feedback text", | ||
"name": "incorrect_feedback", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JavaScript variable should be in camelCase for consistency with other variables, i.e. change to "incorrectFeedback" |
||
"type": "text", | ||
"default": "Sorry, this answer is incorrect", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"description": "Feedback text when incorrect answer is given, variables available: @score and @total.'", | ||
"common": false | ||
}, | ||
{ | ||
"name": "question", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use two whitespaces instead of tabs, as described in H5P code style document.