Skip to content
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

Prevent score point deduction #97

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions language/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
{
"label": "Bepunktungsdetails anzeigen",
"description": "Zeigt die für jede Antwort vergebenen Punkte an."
},
{
"label": "Kein Punktabzug",
"description": "Verhindert den Punktabzug bei falsch markierten Begriffen."
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Test your users by making them select the correct words from a text.",
"majorVersion": 1,
"minorVersion": 11,
"patchVersion": 0,
"patchVersion": 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, bumping the patch version is not strictly required by the change alone (yes, if you want to deploy it, but not on a development system to test), so version number management should be left to the release manager.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I switched back to patchVersion 0

"coreApi": {
"majorVersion": 1,
"minorVersion": 19
Expand Down
5 changes: 3 additions & 2 deletions scripts/mark-the-words.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ H5P.MarkTheWords = (function ($, Question, Word, KeyboardNav, XapiGenerator) {
enableRetry: true,
enableSolutionsButton: true,
enableCheckButton: true,
showScorePoints: true
showScorePoints: true,
preventPointSubstraction: false
},
checkAnswerButton: "Check",
submitAnswerButton: "Submit",
Expand Down Expand Up @@ -472,7 +473,7 @@ H5P.MarkTheWords = (function ($, Question, Word, KeyboardNav, XapiGenerator) {
if (word.isCorrect()) {
result.correct++;
}
else if (word.isWrong()) {
else if (word.isWrong()&&!self.params.behaviour.preventPointSubstraction) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required to add blanks around && to follow the H5P coding style guidelines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this hint.

result.wrong++;
}
else if (word.isMissed()) {
Expand Down
8 changes: 8 additions & 0 deletions semantics.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@
"description": "Show points earned for each answer.",
"importance": "low",
"default": true
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add fields to semantics.json, you'll need to update all the translation files, not just the German one. Otherwise, content in other languages may break. If you cannot translate the strings yourself, you need to use the English text.

The H5P CLI tool can help you with updating translations. You can mark fields with one of the appropriate attributes "status": "new", "status": "updated" or "status": "removed". If you then run h5p update-translations <the-repository-name>, the CLI tool will update all the translations as required and use the English texts as default. One would translate them for real afterwards.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I knew that I shouldn't only update the German language file but didn't know how to change all language files. Thank you so much for clearifying this. As for h5p update-translations <the-repository-name> I received the error "unknown command", but I managed it with the h5p help that suggested add-english-texts <language-code> <library>. Maybe I have to update my H5P CLI tool - the update-translations order would be much more comfortable...

Copy link
Contributor

@otacke otacke Aug 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osa-freiburg Nope, the command is update-translations. The command add-english-texts does something else (that I am not even sure what for) and lead to #97 (review)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you. I have to check this, but probably not today any more, but the day after tomorrow. I'll come back...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it was not a big thing, I just fixed the faulty translation files. The error message was generated from an old h5p CLI - sorry, that I didn't update it in the beginning. Now the update-translations was no problem and all the "englishLabel" and "englishDefault" values disappeared. So the language files should be ok now. Thanks for reviewing!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, one thing FYI: I had to remove the "status": "new" manually in the semantics.json.

{
"name": "preventPointSubstraction",
"type": "boolean",
"label": "No score point deduction",
"importance": "low",
"description": "Enable to prevent score point deduction for wrong marked words.",
"default": false
}
]
},
Expand Down