xApi statements - getScore
Submitted by [email protected] on Thu, 04/16/2020 - 22:16
Forums:
Hi I'm attempting to use some h5p content types in Captivate and need to store some data such as score and completion status. I can see the xApi statements when I use the externaldispatcher and console.log(event.data.statement). However when I try to get something useful by doing console.log(event.getScore()) this returns null or nothing. I've tried to run this on both the arithmetic quiz and the question quiz.
Any pointers on how I can get to what I need?
Thanks Jorgen
otacke
Fri, 04/17/2020 - 07:05
Permalink
Hi Jorgen!What type of xAPI
Hi Jorgen!
What type of xAPI statement are you capturing (what "verb")? xAPI is about more than scores, and H5P makes use of a wider range of experiences that can be tracked. In general, only the statements where the verb property is "completed" will have a "result" property, and only the will getScore() return the actual score.
Best,
Oliver
Best,
Oliver
[email protected]
Sun, 04/19/2020 - 16:37
Permalink
Hi Oliver and thanks for your
Hi Oliver and thanks for your reply! I finally managed to get what I needed from the statement without using the object method like so. Totally new to working with JSON so not sure if it's the best way though ;)
if('result' in myJSON == true){ if('score' in myJSON['result'] == true){ cScore = myJSON['result']['score']['raw']; cMaxScore = myJSON['result']['score']['max']; } }otacke
Mon, 04/20/2020 - 21:39
Permalink
If you want exactly that
If you want exactly that behavior, I'd have gone for
Best, Oliver
[email protected]
Mon, 04/20/2020 - 22:34
Permalink
Awesome, thank you!!
Awesome, thank you!!