You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get cannot read hasOwnPropery of undefined. Turns out, some SCORM packages would request to get value of random objective or interactions if there is no value with that ID.
I suggest the following fixes:
Change L295 to: if (typeof refObject === 'object' && !refObject.hasOwnProperty(structure[i])) {
While investigating this, I found that there is an ever bigger underlying problem that affects both 1.2 and 2004 APIs, where it is impossible to get the value of an interaction (or anything else that has a childArray). For example, window.API.LMSGetValue("cmi.interactions.0.type") will always return an error, even when there is data there.
cmi.interactions.n.type (“true-false”, “choice”, “fill-in”, “matching”, “performance”, “sequencing”, “likert”, “numeric”, WO) Which type of interaction is recorded
If you want to recover the interaction you need to use: cmi.interactions._children (id,objectives,time,type,correct_responses,weighting,student_response,result,latency, RO) Listing of supported data model elements
Hi @gabrieldoty,
First off, cheers for this amazing package. You are genius!!
I wanted to point out a bug I have been getting from some SCORM packages that are running this code.
The following line in scormAPI.js
simplify-scorm/src/scormAPI.js
Line 295 in 2f60c3c
I get cannot read hasOwnPropery of undefined. Turns out, some SCORM packages would request to get value of random objective or interactions if there is no value with that ID.
I suggest the following fixes:
Change L295 to:
if (typeof refObject === 'object' && !refObject.hasOwnProperty(structure[i])) {
and change L300 -
simplify-scorm/src/scormAPI.js
Line 300 in 2f60c3c
refObject = typeof refObject === 'object' ? refObject[structure[i]] : undefined;
This seems to work for nearly all the 50+ packages I have tested so far.
Again, awesome work on this and cheers!!!!
The text was updated successfully, but these errors were encountered: