I'd like to get your opinions about something. We have some code we're using locally which may be of use to others.
It seems to us it is good for data sent from a SCORM package, via SetValue(), to eventually be stored in the database so that student progress data isn't lost. Preserving data is good, we think, even if the network connection is lost, the browser crashes, etc. a few minutes later.
Some SCORM packages don't explicitly call Commit() regularly for whatever reason. Moodle currently doesn't commit data itself unless the SCORM package explicitly calls Commit(), so data can be lost. We wrote some code for local use which will Commit() the data 60 seconds afer the values are set, unless the package Commit()s sooner.
As written, it's a lot like how most OSes write data to disk, to be efficient. It calls commit only if the client (SCO) hasn't already done so explicitly, and calls it only once per 60 seconds even if many values are pending, and doesn't call it at all if no values are pending.
Would this be ueful to other people? If so, I can re-arrange our new code in the form of a patch to scorm/datamodels/scorm_13.js.php. The patch would basically consist of adding to SetValue():
setAutoCommit.timeout = window.setTimeout(API_1484_11.Commit,30000, "");
But canceling that if Commit() is called explicitly:
Let me know what you think about adding this to the master Moodle. Currently our does some magic subclassing to alter the functionallity of the stock code without modifying the files, so I'll reformat it as a patch only if it sound slike the patch would be committed.