skfriese / simple-scorm-api

A simple SCORM1.2 SCO run-time test environment in one file (NOT MAINTAINED)
68 stars 48 forks source link

Limit on Suspend Data #3

Open chrisswany opened 6 years ago

chrisswany commented 6 years ago

I have some courses where the suspend data is over the standard limit of 4096 characters for 1.2. Some of them are up to 70-80k in length. When I try to resume where the user left off with this api it does not work when there is a larger suspend_data count. Do you know if there is a work around for it. Currently I am on SCORM cloud and it will continue using their scorm engine so there must be a work around. I am just storing the cmi data locally so it is not an issue with the data being stored incorrectly.

Just thought I would check to see if you have ran into this.

skfriese commented 5 years ago

Yeah, late reply. This is a dead project, so I don't monitor it.

That being said, I have not run into this. Are you certain this is an issue of length, and not special characters breaking the simple-scorm-api's ability to parse the suspend_data? I know there's an issue with the eval's in the Reload adapter, which you can easily address. There are probably forks of this project out there where this has been solved.

If you have a sample scenario SCO setup somewhere for me to review, I can look into it.

andyresta commented 5 years ago

I use this project too, what the mean suspend data ? I want to know, if my app have some problem too

skfriese commented 5 years ago

I'm not sure what you're asking. The suspend_data usage can be gleaned from the SCORM 1.2 docs.

One issue on which I've provided input in the past is the Reload API's use of "eval" all over the place, and its inability to handle JSON data or certain characters. A quick fix might look like this:

Instead of using this approach:

setString = "this." + element + ".cmivalue =\"" + pre + value + "\";";`
...
var result = eval(setString);

Simply use this: var result = this[element + ".cmivalue"] = pre + value;

Full example:

// correct datatype...
// cmi.comments need to be appended...
if (element == "cmi.comments"){
  pre = this.LMSGetValue("cmi.comments");
  //setString = "this." + element + ".cmivalue =\"" + pre + value + "\";";
  var result = this[element + ".cmivalue"] = pre + value;
}
else{
  //setString = "this." + element + ".cmivalue =\"" + value + "\";";
  var result = this[element + ".cmivalue"] = value;
}

//var result = eval(setString);