title: pipwerks JS SCORM API wrapper sets completed module to incomplete on re-entry
body: <p><strong>Main thrust of question:</strong></p>
  
  <p>When a user re-enters a module which they had already completed and passed, the LMS reflects the course as not having been passed by unchecking the second checkbox in the course menu. It seems that the <a href="http://pipwerks.com/laboratory/scorm/api-wrapper-javascript/" rel="nofollow">pipwerks SCORM API wrapper for JS</a> cannot get a satisfactory status of the course from the LMS and it is automatically setting back the status to <code>incomplete</code>. How can I fix this?</p>
  
  <p><strong>Background and Environment</strong></p>
  
  <p>We've created an HTML/CSS/JS course which is packaged as a multi-SCO PIF. Each SCO within contains a series of slides and an assessment. When a user has gone through all the slides and taken the assessment, I set <code>cmi.completion_status</code> to <code>completed</code>. If they passed the assessment, I set <code>cmi.success_status</code> to <code>passed</code> and if not I set it to <code>failed</code>.</p>
  
  <p>The below code snippet shows use of my custom SCORM session and assessment scoring code to do this:</p>
  
  <pre><code>if (scorm_session &amp;&amp; scoring_info.isComplete()) {
      scorm_session.setParam('cmi.score.min', 0);
      scorm_session.setParam('cmi.score.max', 100);
      scorm_session.setParam('cmi.score.raw', scoring_info.getScore());
      scorm_session.setParam('cmi.success_status', scoring_info.isPass() ? 'passed' : 'failed');
      scorm_session.setParam('cmi.completion_status', 'completed');
  }
  </code></pre>
  
  <p><strong>This works correctly</strong>--I see the AJAX request go out with the proper statuses in the data. Further, I see in the LMS course menu that the first checkbox for that module gets checked for completion, and if passed I see the second one get checked as well.</p>
  
  <p>When the user leaves that module to go to another, those checkboxes stay checked correctly. If the user completely exits the course and later comes back, those boxes are still checked. <strong>If, however, the user re-enters a module he has passed by clicking the title in the course menu, the "passed" checkbox gets unchecked.</strong> So if user wants to go back and look at something in a module he has already completed and passed, he is given the visual indication that he is no longer considered to have passed the course.</p>
  
  <p>It appears that this status change is being triggered by the <a href="http://pipwerks.com/laboratory/scorm/api-wrapper-javascript/" rel="nofollow">pipwerks SCORM API wrapper for JS</a>, but it's due to info it gets back from the LMS on module entry. I see in the console that, on entry, the API asks the LMS for the course status (the API wrapper runs <code>scorm.status("get");</code>). If it receives <code>not attempted</code> or <code>unknown</code> it calls <code>scorm.status("set", "incomplete")</code>.</p>
  
  <p>I see in the console that the request for status goes out and <code>unknown</code> is returned--even when I have explicitly set it to <code>completed</code> and <code>passed</code>. I then immediately see a transmission setting the status to <code>incomplete</code> as the code I described says it will.</p>
  
  <p>This is happening both on <a href="http://cloud.scorm.com" rel="nofollow">http://cloud.scorm.com</a> as well as a Moodle installation we have in place.</p>