How can I capture scores when using other libraries?
I am creating a custom content type which wraps several quiz-based content types. When I use the quiz-based content types on their own the scores are recorded correctly as I see a 'results' tab in my Drupal 7 site and the scores are listed there. However, when I wrap these libraries into a new library the scores are not recorded and the 'results' tab only shows data for 'Name' and 'Start time' but 'Finish time', 'Points awarded' and 'Max points awarded' are blank.
I tried going back to basics and tested the greeting-card-with-task.h5p which is available through the using other libraries tutorial. The issue persists for this content type, with the two wrapped libraries (multiple choice and fill in the blanks) not recording finish time, points awarded and max points awarded when used within the Greetings Card library, but recording scores with no problems when used on their own.
Does anyone have any suggestions for how I might go about getting the greeting-card-with-task.h5p to record the scores correctly?
I should add that I am able to access the xAPI event from the parent library, by appending the code below to the bottom of greetingcard.js. I'm thinking that within this function I need to write the code that will store the result. Any ideas how I should proceed?
H5P.externalDispatcher.on('xAPI', function(event) { if (event.data.statement.verb.display['en-US'] == 'answered') { console.log('I need to store the score'); console.log(event); } });
otacke
Fri, 03/26/2021 - 17:50
Permalink
Hi Colin!You're absolutely on
Hi Colin!
You're absolutely on the right track.
The "score trackers" of all the integrations (Drupal, WordPress, moodle, ...) are not Learning Record Stores. They don't track every xAPI statement - and even if they would, they wouldn't know where to put the results of subcontent, because there's no matching content stored in the database.
You will have to listen for the xAPI results of your children and send out your own statement when you think its time to. For instance, course presentation waits until all its children (that are tasks) have emitted a result and then sends out its own xAPI statement - that the "score trackers" actually listen for. It comes in handy that usually H5P content types implement the Question Type contract, so you don't need to store all the temporary results, but you can simply call your childrens' getScore(), getMaxScore() and getXAPIData() functions to aggregate the results when needed.
Cheers,
Oliver