h5p / h5p-single-choice-set Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The H5P is not rendered at all. If the item is edited (causing the saved state to be reset), the user can use the interactive just once... all further visits to it crash in the same fashion.
Chrome browser console points to two errors:
Uncaught TypeError: Cannot read property 'on' of undefined. single-choice-set.js: line 236
Uncaught TypeError: Cannot read property 'length' of undefined. single-choice-set.js: line 175
(Originally discovered as part of H5P-course-presentation, but tested as a standalone H5P-single-choice-set to confirm this is the source of the problem.)
in xAPI statements about answering questions, the result.success
property should be used to indicate whether or not the question was answered correctly. result.completion
should be used to indicate that the question was completed.
For example:
{
"id": "a5bfa399-1959-4535-9668-274361250a37",
"actor": {
"name": "admin",
"mbox": "mailto:[email protected]",
"objectType": "Agent"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/answered",
"display": {
"en-US": "answered"
}
},
"result": {
"score": {
"scaled": 1,
"raw": 1,
"min": 0,
"max": 1
},
"response": "0",
"completion": true,
"success": true
},
"context": {
"contextActivities": {
"grouping": [],
"parent": [
{
"id": "http://localhost:8888/wordpress/wp-admin/admin-ajax.php?action=h5p_embed&id=15",
"objectType": "Activity"
}
]
}
},
"timestamp": "2017-01-02T11:09:00.460Z",
"stored": "2017-01-02T11:09:00.460Z",
"authority": {
"name": "H5P",
"account": {
"homePage": "https://sandbox.watershedlrs.com",
"name": "CDrGGtiYAEjUFr"
},
"objectType": "Agent"
},
"version": "1.0.0",
"object": {
"id": "http://localhost:8888/wordpress/wp-admin/admin-ajax.php?action=h5p_embed&id=15?subContentId=cc60f80f-2f94-43ee-8939-63b736b8ec21",
"definition": {
"extensions": {
"http://h5p.org/x-api/h5p-local-content-id": 15,
"http://h5p.org/x-api/h5p-subContentId": "cc60f80f-2f94-43ee-8939-63b736b8ec21"
},
"description": {
"en-US": "bob bib bab"
},
"type": "http://adlnet.gov/expapi/activities/cmi.interaction",
"interactionType": "choice",
"correctResponsesPattern": [
"0"
],
"choices": [
{
"id": "0",
"description": {
"en-US": "bub"
}
},
{
"id": "1",
"description": {
"en-US": "byb"
}
}
]
},
"objectType": "Activity"
}
}
Is there a reason why the maximum alternative answers is restricted to only 4?
Although I can change the number to something higher via the h5pmods_alter_semantics hook, I am just wondering because it seems to me quite limited.
Besides of that, thank you for the great work!
Hello,
This happens in Moodle with Boost-theme, if you use Clean-theme all of the created "single choice set" -questions are stacked and you cannot select them at all before saving and editing again.
Tested with Moodle Moodle 3.3.1+ (Build: 20170810) and mod_hvp 1.5 & Single Choice Set (1.9.6) & Course Presentation Editor (1.17.4) & Boost/Clean themes.
Hello,
Single choice set -question in course presentation is preventing editor from loading in Moodle, also you cannot access pages that has single choice question added. Tested with Moodle 3.5, mod_hvp 1.21.0 & H5P Editor Single Choice Set Textual Editor (1.0.7) & Single Choice Set (1.11.11)
Console is giving error
single-choice-set.js?ver=1.11.11:477 Uncaught TypeError: Cannot read property 'a11yRetry' of undefined
at SingleChoiceSet.H5P.SingleChoiceSet.SingleChoiceSet.addButtons (single-choice-set.js?ver=1.11.11:477)
at SingleChoiceSet.H5P.SingleChoiceSet.SingleChoiceSet.registerDomElements (single-choice-set.js?ver=1.11.11:452)
at SingleChoiceSet.Question.self.attach (question.js?ver=1.4.7:1583)
at S.attachElement (h5p-course-presentation.js?ver=1.22.2:1)
at i.t.appendElements (h5p-course-presentation.js?ver=1.22.2:1)
at S.createSlides (h5p-course-presentation.js?ver=1.22.2:1)
at S.attach (h5p-course-presentation.js?ver=1.22.2:1)
at H5PEditor.CoursePresentation.appendTo (cp-editor.js?ver=1.22.1:250)
at Object.ns.processSemanticsChunk (h5peditor.js?ver=2020080400:475)
at ns.Form.processSemantics (h5peditor-form.js?ver=2020080400:445)
This issue is accessibility related.
Description:
The Single Choice Set functionality has much in common with a radiogroup form type. Therefore I would suggest a change back to a HTML markup that reflects a radiogroup for each question.
The reason for this is that a radiogroup let users know that there is some user input expected.
Currently a different set of semantics is communicated to users with assistive technology through ARIA. Of which the question as is is currently communicated as being an application. Application role is meant to use for desktop like applications, for example a draw application like paint.
Proposed solution:
(technical) related
Change the markup for the question + answer(s) sets to radiogroup HTML markup so that information and relationships are programmatically determinable for assistive technology.
Like:
<fieldset>
<legend>Question?</legend>
<div class="radio">
<input type="radio" id="answer-1" name="singlechoice-question">
<label for="answer-1">Answer 1</label>
</div>
<div class="radio">
<input type="radio" id="answer-2" name="singlechoice-question">
<label for="answer-2">Answer 2</label>
</div>
<div class="radio">
<input type="radio" id="answer-3" name="singlechoice-question">
<label for="answer-3">Answer 3</label>
</div>
</fieldset>
It would be desirable if the display of solutions could be disabled.
So if the answer is wrong, the correct answer is not marked.
I have tried this with the latest release (1.11.9). The problem has become apparent when, in Moodle, after finishing a single choice set, the attempt is not counted as "completed" and it is also not shown whether the attempt was successful. This is the requestjson
which was sent in the POST request after finishing the single choice set:
[
{
"actor":{
"name":"[email protected]",
"mbox":"mailto:[email protected]",
"objectType":"Agent"
},
"verb":{
"id":"http://adlnet.gov/expapi/verbs/answered",
"display":{
"en-US":"answered"
}
},
"object":{
"id":"https://bla.bla.bla/xapi/activity/311",
"objectType":"Activity",
"definition":{
"interactionType":"compound",
"type":"http://adlnet.gov/expapi/activities/cmi.interaction",
"extensions":{
"http://h5p.org/x-api/h5p-local-content-id":11
}
}
},
"result":{
"duration":"PT23.509999999999998S",
"score":{
"raw":2,
"min":0,
"max":2,
"scaled":1
}
}
},
{
"actor":{
"name":"[email protected]",
"mbox":"mailto:[email protected]",
"objectType":"Agent"
},
"verb":{
"id":"http://adlnet.gov/expapi/verbs/answered",
"display":{
"en-US":"answered"
}
},
"context":{
"contextActivities":{
"parent":[
{
"id":"https://bla.bla.bla/xapi/activity/311",
"objectType":"Activity"
}
]
}
},
"object":{
"id":"https://bla.bla.bla/xapi/activity/311?subContentId=ccf22619-c268-41ff-b3f5-e8a556370045",
"objectType":"Activity",
"definition":{
"description":{
"en-US":"Antwort 1"
},
"interactionType":"choice",
"correctResponsesPattern":[
"0"
],
"type":"http://adlnet.gov/expapi/activities/cmi.interaction",
"choices":[
{
"id":"0",
"description":{
"en-US":"Antwort 1"
}
},
{
"id":"1",
"description":{
"en-US":"Antwort 2"
}
}
],
"extensions":{
"http://h5p.org/x-api/h5p-local-content-id":11,
"http://h5p.org/x-api/h5p-subContentId":"ccf22619-c268-41ff-b3f5-e8a556370045"
}
}
},
"result":{
"response":"0",
"completion":true,
"success":true,
"duration":"PT16.93S",
"score":{
"raw":1,
"min":0,
"max":1,
"scaled":1
}
}
},
{
"actor":{
"name":"[email protected]",
"mbox":"mailto:[email protected]",
"objectType":"Agent"
},
"verb":{
"id":"http://adlnet.gov/expapi/verbs/answered",
"display":{
"en-US":"answered"
}
},
"context":{
"contextActivities":{
"parent":[
{
"id":"https://bla.bla.bla/xapi/activity/311",
"objectType":"Activity"
}
]
}
},
"object":{
"id":"https://bla.bla.bla/xapi/activity/311?subContentId=6ccb3edb-a1c6-4278-b0f6-e5fc2dec70be",
"objectType":"Activity",
"definition":{
"description":{
"en-US":"Antwort 1"
},
"interactionType":"choice",
"correctResponsesPattern":[
"0"
],
"type":"http://adlnet.gov/expapi/activities/cmi.interaction",
"choices":[
{
"id":"0",
"description":{
"en-US":"Antwort 1"
}
},
{
"id":"1",
"description":{
"en-US":"Antwort 2"
}
}
],
"extensions":{
"http://h5p.org/x-api/h5p-local-content-id":11,
"http://h5p.org/x-api/h5p-subContentId":"6ccb3edb-a1c6-4278-b0f6-e5fc2dec70be"
}
}
},
"result":{
"response":"0",
"completion":true,
"success":true,
"duration":"PT6.58S",
"score":{
"raw":1,
"min":0,
"max":1,
"scaled":1
}
}
}
]
Evidently, result.success
and result.completion
are missing. I don't know why it wasn't fixed by da4cbae, but I double checked that my H5P-package contains the code of that commit, and it does.
Hello,
There is pretty bad bug in single choice set and translations in mod_hvp 1.7
f.ex in finnish translation Retry button is labeled "try again" and "try again" -button is labeled "retry" also all of the rest translations are wrong.
When moodle language is set to finnish everything seems fine in the translations but when you change moodle language to english you see how everything is wrong.
This might have something to do with that at least in finnish translation the first row in translation settings "Label for the "Next" button" that is shown in the english translations is missing all together.
and because of it all the translations skip to next available row and thus creating situation that every translation goes wron. @falcon-git
Finnish translations
Oikea vastaus = correct answer
Yritä uudelleen = try again
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.