Moodle
  1. Moodle
  2. MDL-25320

SCORM cmi.<group>._children string return includes spaces

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.9.10
    • Fix Version/s: 2.0.2
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      Windows 7/IE8
    • Database:
      Any
    • URL:
      http://www.prince2cbt.net log in as fred, password Shirley28*
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      1568

      Description

      The elements of the return string from LMSGetValue("cmi.<group>._children") are separated by space-comma instead of being comma-separated (i.e. grammatically readable, but bad computer-speak). The following lines are taken from the debug of a course developed in another LMS system; note the unwanted spaces preceding each child after the first, resulting in a 201 invalid argument error:

      LMSGetValue("cmi.core._children") - student_id, student_name, lesson_location, credit, lesson_status, entry, score, total_time, lesson_mode, exit, session_time => 0
      LMSGetValue("cmi.core.student_id") - fred => 0
      LMSGetValue("cmi.core. student_name") - => 201
      LMSGetValue("cmi.core. lesson_location") - => 201
      LMSGetValue("cmi.core. credit") - => 201
      LMSGetValue("cmi.core. lesson_status") - => 201
      LMSGetValue("cmi.core. entry") - => 201
      LMSGetValue("cmi.core. score") - => 201
      LMSGetValue("cmi.core. lesson_mode") - => 201

      The SCORM runtime documentation is not explicit about this, except for the example shown for cmi.core._children, and without space-stripping these spaces break code that processes the return from a _children enquiry.

        Activity

        Hide
        Dan Marsden added a comment -

        thanks Ian - makes sense although I can't see an example in the spec for cmi.core._children (at least not in 1.2 docs) - can you be more specific about where in the docs the example is given?

        Show
        Dan Marsden added a comment - thanks Ian - makes sense although I can't see an example in the spec for cmi.core._children (at least not in 1.2 docs) - can you be more specific about where in the docs the example is given?
        Hide
        Matteo Scaramuccia added a comment -

        Hi Dan,
        find it in:

        Shortly: I could confirm the issue even though I never fall into it on delivering courses w/ Moodle, maybe 'cause my contents are not used to check RTE capabilities and/or they are used to explode and trim _children values by default.

        ADL Test Suite regressions here should not be critical at all (pretty sure it doesn't check for spaces... need time to check it) and most of the time content developers are used to trim or to .indexOf the returned string.
        Note: something similar must be applied to scorm_13.js.php too, 1st proposal applying a fix to all _children patterns:

        Index: scorm_12.js.php
        ===================================================================
        RCS file: /cvsroot/moodle/moodle/mod/scorm/datamodels/scorm_12.js.php,v
        retrieving revision 1.6.2.18
        diff -u -r1.6.2.18 scorm_12.js.php
        --- scorm_12.js.php	10 Jul 2010 08:17:44 -0000	1.6.2.18
        +++ scorm_12.js.php	19 Nov 2010 20:26:00 -0000
        @@ -36,15 +36,15 @@
             CMIResult = '^correct$|^wrong$|^unanticipated$|^neutral$|^([0-9]{0,3})?(\.[0-9]{1,2})?$';
             NAVEvent = '^previous$|^continue$';
             // Children lists
        -    cmi_children = 'core, suspend_data, launch_data, comments, objectives, student_data, student_preference, interactions';
        -    core_children = 'student_id, student_name, lesson_location, credit, lesson_status, entry, score, total_time, lesson_mode, exit, session_time';
        -    score_children = 'raw, min, max';
        -    comments_children = 'content, location, time';
        -    objectives_children = 'id, score, status';
        +    cmi_children = 'core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions';
        +    core_children = 'student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time';
        +    score_children = 'raw,min,max';
        +    comments_children = 'content,location,time';
        +    objectives_children = 'id,score,status';
             correct_responses_children = 'pattern';
        -    student_data_children = 'mastery_score, max_time_allowed, time_limit_action';
        -    student_preference_children = 'audio, language, speed, text';
        -    interactions_children = 'id, objectives, time, type, correct_responses, weighting, student_response, result, latency';
        +    student_data_children = 'mastery_score,max_time_allowed,time_limit_action';
        +    student_preference_children = 'audio,language,speed,text';
        +    interactions_children = 'id,objectives,time,type,correct_responses,weighting,student_response,result,latency';
             // Data ranges
             score_range = '0#100';
             audio_range = '-1#100';
        

        HTH,
        Matteo

        Show
        Matteo Scaramuccia added a comment - Hi Dan, find it in: http://www.adlnet.gov/Technologies/scorm/SCORMSDocuments/Previous%20Versions/SCORM%201.2/Documentation%20Suite%20(SCORM%201.2)/SCORM_1_2_pdf.zip , file SCORM_1.2_RunTimeEnv.pdf , pg. 3-20: the spec reports a space just among entry and score , mostly a typo. More examples on cmi.objectives._children , pg 3-37 or pg 3-39 with cmi.objectives.n.score._children or pg 3-42 with cmi.student_data._children and so on. Ambiguos spaces in cmi.student_preference._children , pg 3-45 ; IEEE 1484.11.4 JavaScript Content to LMS Communications API Binding, Sample : even if related w/ SCORM 2004 it confirms comma-separated with an explicit sample, §7.2.1.1 pg. 29; ADL SCORM 2004 specs do not give an explicit example but talks again about comma-separated. Shortly: I could confirm the issue even though I never fall into it on delivering courses w/ Moodle, maybe 'cause my contents are not used to check RTE capabilities and/or they are used to explode and trim _children values by default. ADL Test Suite regressions here should not be critical at all (pretty sure it doesn't check for spaces... need time to check it) and most of the time content developers are used to trim or to .indexOf the returned string. Note: something similar must be applied to scorm_13.js.php too, 1st proposal applying a fix to all _children patterns: Index: scorm_12.js.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/scorm/datamodels/scorm_12.js.php,v retrieving revision 1.6.2.18 diff -u -r1.6.2.18 scorm_12.js.php --- scorm_12.js.php 10 Jul 2010 08:17:44 -0000 1.6.2.18 +++ scorm_12.js.php 19 Nov 2010 20:26:00 -0000 @@ -36,15 +36,15 @@ CMIResult = '^correct$|^wrong$|^unanticipated$|^neutral$|^([0-9]{0,3})?(\.[0-9]{1,2})?$'; NAVEvent = '^previous$|^ continue $'; // Children lists - cmi_children = 'core, suspend_data, launch_data, comments, objectives, student_data, student_preference, interactions'; - core_children = 'student_id, student_name, lesson_location, credit, lesson_status, entry, score, total_time, lesson_mode, exit, session_time'; - score_children = 'raw, min, max'; - comments_children = 'content, location, time'; - objectives_children = 'id, score, status'; + cmi_children = 'core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions'; + core_children = 'student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time'; + score_children = 'raw,min,max'; + comments_children = 'content,location,time'; + objectives_children = 'id,score,status'; correct_responses_children = 'pattern'; - student_data_children = 'mastery_score, max_time_allowed, time_limit_action'; - student_preference_children = 'audio, language, speed, text'; - interactions_children = 'id, objectives, time, type, correct_responses, weighting, student_response, result, latency'; + student_data_children = 'mastery_score,max_time_allowed,time_limit_action'; + student_preference_children = 'audio,language,speed,text'; + interactions_children = 'id,objectives,time,type,correct_responses,weighting,student_response,result,latency'; // Data ranges score_range = '0#100'; audio_range = '-1#100'; HTH, Matteo
        Hide
        Dan Marsden added a comment -

        Thanks Matteo - not sure how I missed those! - helps to have the right file open!

        the fact that it seems to interchange using spaces in a range of areas seems to suggest it's not a "hard" requirement of the spec. But - it makes sense to me to remove the spaces to prevent issues for scorm developers who don't trim the values before use.

        I've pushed a fix into head (just before 2.0 release) - I'll push a fix into 1.9Stable later this week

        thanks!

        Show
        Dan Marsden added a comment - Thanks Matteo - not sure how I missed those! - helps to have the right file open! the fact that it seems to interchange using spaces in a range of areas seems to suggest it's not a "hard" requirement of the spec. But - it makes sense to me to remove the spaces to prevent issues for scorm developers who don't trim the values before use. I've pushed a fix into head (just before 2.0 release) - I'll push a fix into 1.9Stable later this week thanks!
        Hide
        Sam Hemelryk added a comment -

        Whoops sorry Dan, wrong issue.

        Show
        Sam Hemelryk added a comment - Whoops sorry Dan, wrong issue.
        Hide
        Dan Marsden added a comment -

        A Pull request has been submitted for this bug - it will hopefully get pushed into the next 1.9 weekly (the fix has been in 2.0 for a while) - please see the attached pull request for further info.

        Show
        Dan Marsden added a comment - A Pull request has been submitted for this bug - it will hopefully get pushed into the next 1.9 weekly (the fix has been in 2.0 for a while) - please see the attached pull request for further info.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: