scorm-again
scorm-again copied to clipboard
Errors recording SCORM 2004 interactions
I'm using Scorm2004API and hosting Articulate Rise 360 courses. When users interact with multiple choice quizzes I'm getting logs with errors like:
scorm-again.js:7108 Uncaught Error: Data Model Element Type Mismatch
at throwTypeMismatchError (scorm-again.js:7108:11)
at CMIInteractionsObject.set (scorm-again.js:8354:13)
at Scorm2004API._commonSetCMIValue (scorm-again.js:1178:38)
at Scorm2004API.setCMIValue (scorm-again.js:2628:21)
at Scorm2004API.loadFromJSON (scorm-again.js:1677:20)
at Scorm2004API.loadFromJSON (scorm-again.js:1675:20)
at Scorm2004API.loadFromJSON (scorm-again.js:1675:20)
at scorm-again.js:1644:18
at Array.forEach (
I tried to debug, the issue seems to be that 'cmi.interactions.n.learner_response' is getting processed before 'cmi.interactions.n.type'. Hence, this.type is empty so response_type is undefined.
I have solved the issue. Basically, the issue was regex pattern(int_pattern, obj_pattern) were not matching with data model strings because regex patterns contain "cmi." prefix whereas data model strings do not contain "cmi." prefix. I have removed the "cmi." prefix and it started working. Below is the screenshot where I have commented the old patterns, this might not be proper solution but that was the actual bug.