|
LMSFinish() should return string "true" on success and string "false" for any other state, such as if additional API calls cannot be guaranteed to process correctly. If the HTTP call failed then I'd consider that a failure of LMSFinish as the SCO cannot be assured that data set with LMSSetValue() has been persisted. I believe the appropriate SCORM 1.2 error code would be "101" (General Exception). That would also allow me to give warning to the user that all their work has just been lost. It may be worth keeping the SCO<>LMS state connected in such a failure so that the SCO has the opportunity to retry LMSFinish(), or putting a multi-attempt fallback mechanism into the way session data is fed back to the database to handle situations of high load or temporary connectivity loss.
Hi Peter - do you think the path Jamie attached here is adequate? - or should we be returning an errorcode instead?
It is adequate, as knowing about data write-back failure is the main thing when the communications layer fails. That can then trigger investigation into the cause. Addition error information would then be useful in debugging mode.
Thanks Peter - fix pushed into HEAD - can you please check it out before I push to stable?
http://cvs.moodle.org/moodle/mod/scorm/datamodels/scorm_12.js.php?r1=1.23&r2=1.24 just following up - has anyone been able to test and verify this fix works on their 1.9 install?
thanks, Hi Dan,
I cannot test it right now but I want to highlight a possible issue regarding with the fix submitted in HEAD i.e. just looking at the code flow. Please, find below the comment at the fix and our proposal for the discussion. result is now proposed to be evaluated through the return value of StoreData; this return value is built with this logic below: result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring); results = String(result).split('\n'); errorCode = results[1]; return results[0]; Everything will work as expected (i.e. true or false) until the AJAX call will fail: if (httpReq.status == 200) { //popupwin(url+"\n"+param+"\n"+httpReq.responseText); return httpReq.responseText; } else { return httpReq.status; } so it could be IMHO better to code ''true if true, false otherwise'', e.g.: @@ -199,13 +199,20 @@
setTimeout('top.document.location=top.next;',500);
}
}
+ <?php
+ if (debugging('',DEBUG_DEVELOPER)) {
+ echo 'LogAPICall("LMSFinish", "AJAXResult", result, 0);';
+ }
+ ?>
+ result = ('true' == result ? 'true' : 'false');
<?php
if (debugging('',DEBUG_DEVELOPER)) {
//echo 'alert("Finished SCORM 1.2");';
+ echo 'LogAPICall("LMSFinish", "result", result, 0);';
echo 'LogAPICall("LMSFinish", param, "", 0);';
}
?>
- return "true";
+ return result;
} else {
errorCode = "301";
}
Note: I've rearranged also the LogAPICall parameters order, according to the signature&logic found in scorm_12.js.php. I would like to express a sense of urgency for this. We have been experiencing this for the past few months where occasionaly a user would take a SCORM course and provide a screenprint of the final score showing completion, however there is absolutely no SCORM data, the status remains at Not Attempted. Based on less than 100 users, It is a small percentage of the total users at this time.
However, we are about to setup a new instlation of Moodle that will serve over 10,000 user starting in March and we are very concerned that the number of users experiencing this issue is going to climb rather quickly just by volume. Let me add my 2 cents:
BTW, @Ron: if you're using Mastery Score in your packages, it could be possible that a failure in setting the cmi.core.lesson_status value could issue what described in MDL-21305 After reviewing the flow of logic, the line: result = ('true' == result ? 'true' : 'false'); is not quite enough.
If it is set to false, then errorCode should also be set to conform to SCORM standards. I recommend the following: result = ('true' == result) ? 'true' : 'false'; Good catch Ron!
I've missed the errorCode issue. Thanks, |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cheers,
Piers Harding.