gabrieldoty / simplify-scorm

Scorm 1.2 Javascript API
MIT License
230 stars 77 forks source link

Fix _count returning an empty string when length is 0 #25

Closed xob closed 4 years ago

xob commented 4 years ago

Some SCOs failed to handle the empty string and failed when writing interactions

Lpsd commented 4 years ago

Is this not also required for the 1.2 API?

xob commented 4 years ago

Is this not also required for the 1.2 API?

It is, but the 1.2 API does not have the problem of replacing a 0 value with an empty string.

The problem was in the getCMIValue function, where the 2004 API did return refObject || "";, which replaced zeroes with an empty string. The 1.2 API does this instead: return refObject;

In other words, the 1.2 API did not need fixing for this particular issue.