Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.8
    • Component/s: SCORM
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      We've found that AICC API data storing not working at all.

      Error in file /mod/scorm/datamodels/aicc.js.php
      scoid and attempt params aren't passed to http request in function StoreData, so request returns 404 error

      function StoreData(data,storetotaltime) {
      if (storetotaltime) {
      if (cmi.core.lesson_mode == 'normal') {
      if (cmi.core.credit == 'credit') {
      cmi.core.lesson_status = 'completed';
      if (cmi.student_data.mastery_score != '') {
      if (cmi.core.score.raw >= cmi.student_data.mastery_score)

      { cmi.core.lesson_status = 'passed'; }

      else

      { cmi.core.lesson_status = 'failed'; }

      }
      }
      }
      if (cmi.core.lesson_mode == 'browse') {
      if (datamodel['cmi.core.lesson_status'].defaultvalue == '')

      { cmi.core.lesson_status = 'browsed'; }

      }
      datastring = CollectData(data,'cmi');
      datastring += TotalTime();
      } else

      { datastring = CollectData(data,'cmi'); }

      + datastring += '&attempt=<?php echo $attempt ?>';
      + datastring += '&scoid=<?php echo $scoid ?>';

      //popupwin(datastring);
      var myRequest = NewHttpReq();
      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];
        }

      Strings started with "+" should be added
      String started with "*" should be updated

        Gliffy Diagrams

          Activity

          Hide
          danmarsden Dan Marsden added a comment -

          adding Martin Holden to this - Martin - any chance you could confirm this as an issue? - any other comments?

          thanks!

          Show
          danmarsden Dan Marsden added a comment - adding Martin Holden to this - Martin - any chance you could confirm this as an issue? - any other comments? thanks!
          Hide
          matteo Matteo Scaramuccia added a comment -

          1. HTTP Status 404 - Due to required_param() calls (function defined in lib/moodlelib.php) on both the missing integer parameters, "scoid" and "attempt". This function internally calls error(), lib/deprecatedlib.php:

          ...
              if (! defined('HEADER_PRINTED')) {
                  //header not yet printed
                  @header('HTTP/1.0 404 Not Found');
                  print_header(get_string('error'));
          ...

          Note: the same applies if using print_error(), lib/weblib.php.

          2. String casting - Already done on SCORM APIs:
          http://tracker.moodle.org/browse/MDL-13716
          http://cvs.moodle.org/moodle/mod/scorm/datamodels/scorm_12.js.php?r1=1.8&r2=1.9
          http://cvs.moodle.org/moodle/mod/scorm/datamodels/scorm_13.js.php?r1=1.35&r2=1.36

          HTH,
          Matteo

          Show
          matteo Matteo Scaramuccia added a comment - 1. HTTP Status 404 - Due to required_param() calls (function defined in lib/moodlelib.php ) on both the missing integer parameters, "scoid" and "attempt" . This function internally calls error() , lib/deprecatedlib.php : ... if (! defined('HEADER_PRINTED')) { //header not yet printed @header('HTTP/1.0 404 Not Found'); print_header(get_string('error')); ... Note: the same applies if using print_error() , lib/weblib.php . 2. String casting - Already done on SCORM APIs: http://tracker.moodle.org/browse/MDL-13716 http://cvs.moodle.org/moodle/mod/scorm/datamodels/scorm_12.js.php?r1=1.8&r2=1.9 http://cvs.moodle.org/moodle/mod/scorm/datamodels/scorm_13.js.php?r1=1.35&r2=1.36 HTH, Matteo
          Hide
          danmarsden Dan Marsden added a comment -

          thanks Matteo - I've fixed the string casting in 1.8Stable 1.9Stable and Head - can you confirm that we need to add scoid and attemptid to the datastring as well? - or is that not required? - thanks!

          Show
          danmarsden Dan Marsden added a comment - thanks Matteo - I've fixed the string casting in 1.8Stable 1.9Stable and Head - can you confirm that we need to add scoid and attemptid to the datastring as well? - or is that not required? - thanks!
          Hide
          matteo Matteo Scaramuccia added a comment -

          Hi Dan,
          unfortunately we've no AICC courses using API instead of HACP (HTTP AICC Communication Protocol) so no test can be performed.
          IMHO it seems feasible to have an HTTP Status 404 returned back to the browser due to the required_param() call at the very start of the code in datamodel.php i.e. no chance to get those value from other code i.e it seems safe to add these 2 HTTP GET values even if not required.

          I know this is not really what you've asked me

          Show
          matteo Matteo Scaramuccia added a comment - Hi Dan, unfortunately we've no AICC courses using API instead of HACP (HTTP AICC Communication Protocol) so no test can be performed. IMHO it seems feasible to have an HTTP Status 404 returned back to the browser due to the required_param() call at the very start of the code in datamodel.php i.e. no chance to get those value from other code i.e it seems safe to add these 2 HTTP GET values even if not required. I know this is not really what you've asked me
          Hide
          danmarsden Dan Marsden added a comment -

          thanks Matteo - all good.

          fix for extra params now in 1.9Stable and HEAD

          Show
          danmarsden Dan Marsden added a comment - thanks Matteo - all good. fix for extra params now in 1.9Stable and HEAD

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Mar/10