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

JS Error for the Dictation content type #1

Open
emostoyanov opened this issue Aug 26, 2020 · 1 comment
Open

JS Error for the Dictation content type #1

emostoyanov opened this issue Aug 26, 2020 · 1 comment

Comments

@emostoyanov
Copy link

Hi, I've installed recently your RTL version of H5P module in our Moodle environment and I am facing an issue with the latest Moodle version (3.9) and the Dictation H5P content type specifically. The H5P content iframe is not loaded and there is a JS error in the browser console:

Uncaught TypeError: Cannot read property 'getUsersScore' of undefined
at t. (h5p-x-api.js?ver=2020020500:125)
at t.call (h5p-event-dispatcher.js?ver=2020020500:209)
at t.EventDispatcher.trigger (h5p-event-dispatcher.js?ver=2020020500:240)
at t.EventDispatcher.trigger (h5p-event-dispatcher.js?ver=2020020500:252)
at t.s.triggerXAPI (7a4e5e109e08eee9a4ca156fff00be30b03cf770.js:4417)
at t.H5P.EventDispatcher.setActivityStarted (h5p-x-api.js?ver=2020020500:101)
at t.Question.self.attach (7a4e5e109e08eee9a4ca156fff00be30b03cf770.js:3331)
at Object.H5P.newRunnable (h5p.js?ver=2020020500:984)
at HTMLDivElement. (h5p.js?ver=2020020500:141)
at Function.each (jquery.js?ver=2020020500:2)

This H5P content item was downloaded from their examples site. The rest of the h5p CTs are loaded all right. Tried in different Moodle themes, same result. If I use latest upstream version of H5P (1.21) the problem disappears and Dictation H5P iframe is displayed. I would be grateful if you can confirm the issue and eventually suggest a fix.

Thank you!
Emil
console

@emostoyanov
Copy link
Author

emostoyanov commented Aug 27, 2020

For the time being I was able to bypass the error by commenting few lines in library/js/h5p-x-api.js , the last function

H5P.externalDispatcher.on('xAPI', function (event) {
// if (event.getVerb() === 'answered' &&
if (event.getVerb() === 'answered') {
// And in case we have some interactive content inside "slides"...
// typeof this.parent.getUsersScore !== "undefined") {
// var total_score = this.parent.getUsersScore();
// var total_maxScore = this.parent.getUsersMaxScore();
var contentId = event.getVerifiedStatementValue(
['object', 'definition', 'extensions', 'http://h5p.org/x-api/h5p-local-content-id']);
if (H5P.opened[contentId] === undefined) {
H5P.opened[contentId] = new Date();
}
// H5P.setFinished(contentId, total_score, total_maxScore);

}
});

but in this way I think score reporting functionality is lost.

Emil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant