jcputney / scorm-again

A modern SCORM JavaScript runtime library.
https://jcputney.github.io/scorm-again/
MIT License
214 stars 53 forks source link

Errors recording SCORM 2004 interactions #622

Open kfahad5607 opened 1 year ago

kfahad5607 commented 1 year ago

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 () at Scorm2004API.loadFromFlattenedJSON (scorm-again.js:1640:16)

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.

kfahad5607 commented 1 year ago

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.

Screenshot 2023-03-16 175607

github-actions[bot] commented 1 day ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.