Search code examples
javascriptscormscorm2004

How do I get completion_status value from SCORM cloud?


I've been attempting some custom SCORM content using the pipwerks SCORM API wrapper. In this instance, I'm using a SCORM 2004 4th ed package.

If I launch and complete the course, the course is correctly shown as complete, and the sandboxed registration state shows the Runtime Data > cmi.completion_status: completed.

Course info

The following is an excerpt from the debug log showing the completion_status being set and the final commit.

- [14:01:43.632] SetValue('cmi.completion_status', 'completed') returned 'true' in 0 seconds
[14:01:43.632] CheckForSetValueError (cmi.completion_status, completed, cmi.completion_status, , )
[14:01:43.632] Element is: completion_status
[14:01:43.632] Call is error free.
[14:01:43.632] StoreValue (cmi.completion_status, completed, cmi.completion_status, , )
[14:01:43.632] Element is: completion_status
- [14:01:43.632] Commit('') returned 'true' in 0.004 seconds
[14:01:43.632] Checking for Commit Error
[14:01:43.632] Call is error free.
[14:01:43.636] CompletedByMeasure is not enabled, using the completion status recorded by the SCO-completed
[14:01:43.636] Scaled Passing Score is not specified, using the success status recorded by the SCO-unknown
[14:09:29.134] Close Out Session
[14:09:29.134] Mode = normal
[14:09:29.134] Credit = credit
[14:09:29.134] Recorded CompletionStatus = completed
[14:09:29.134] Recorded SuccessStatus = unknown
[14:09:29.134] ScaledPassingScore = null
[14:09:29.134] Score = null
[14:09:29.134] CompletedByMeasure = false
[14:09:29.134] Progress Measure = 1
[14:09:29.134] Session Time: (0 hundredths)
[14:09:29.134] Previous Time: PT0H0M0S (0 hundredths)
[14:09:29.134] New Total Time: PT0H0M0S (0 hundredths)
[14:09:29.135] New Tracked Total Time: PT8M13.59S
[14:09:29.135] CompletedByMeasure is not enabled, using the completion status recorded by the SCO-completed
[14:09:29.135] Scaled Passing Score is not specified, using the success status recorded by the SCO-unknown

So at this point, all looks good. However, if I launch the course a second time, the result is unknown.

- [14:19:20.067] GetValue('cmi.completion_status') returned 'unknown' in 0.003 seconds
[14:19:20.069] Checking for GetValue Error
[14:19:20.069] Element is: completion_status
[14:19:20.069] Call is error free.
[14:19:20.070] RetrieveGetValueData (cmi.completion_status, cmi.completion_status, , )
[14:19:20.070] Element is: completion_status
[14:19:20.070] CompletedByMeasure is not enabled, using the completion status recorded by the SCO-unknown

I'm also storing cmi.progress_measure which is updating the progress display correctly, and appearing in the registration state correctly. Again, when launching the course again, this data is also empty.

For reference, I'm setting the completion status as follows;

pipwerks.SCORM.status("set", "completed");
pipwerks.SCORM.save();

And the progress measure as follows (where s.progress is a decimal 0-1);

pipwerks.SCORM.data.set("cmi.progress_measure", s.progress);
pipwerks.SCORM.save();

These appear to be functioning correctly looking at the debug log and registration state, but I'm unable to get these values again when I relaunch the course.

Can anyone suggest what might be happening here?

Many thanks,

Baps.


Solution

  • The issue you're running into is likely the "Mode" (Exit Mode) being set to normal. Per the SCORM specification if you exit a course with "normal" mode and then relaunch the course all of the runtime data is going to be reset. If you go into your SCORM wrapper and change the exit mode to "suspend" the runtime data will be preserved between launches.

    You can find a discussion of this exact issue on the pipwerks site here:

    https://pipwerks.com/2008/05/10/cmicoreexit-cmiexit/

    And an example of how to set the exit status in the pipwerks wrapper (SCORM 2004):

    //the status gets set by your course code
    var courseStatus = "incomplete";
    function quit(){
       if(courseStatus === "completed"){
          scorm.set("cmi.exit", "logout");
       } else {
          scorm.set("cmi.exit", "suspend");
       }
    
       scorm.quit();
    }
    

    If you have more questions you can reach out to [email protected]. That will get you in touch with someone at Rustici Software. We're also the folks who provide the SCORM Cloud service.