Moodle
  1. Moodle
  2. MDL-30645

Default value of some CMI elements is not computed correctly.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.3
    • Fix Version/s: 2.2.1
    • Component/s: SCORM
    • Testing Instructions:
      Hide

      It can be tested by running the SCORM Test Harness for DMI package - Data Model Implementation Test 1.
      1. Download the DMI Test package.
      2. Run the SCORM Test Harness for DMI as specified here - SCORM Test Harness
      3. Check the Log to make sure these errors do not show:
      (for Resumed Activity 1)
      ERROR: Evaluating GetValue("cmi.progress_measure") - Expected: "0.9" - LMS Returned: ""
      ERROR: Evaluating GetLastError("") - Expected: "0" - LMS Returned: "403"

      (for Resumed Activity 4)
      ERROR: Evaluating GetValue("cmi.learner_preference.audio_level") - Expected: "50.9" - LMS Returned: "1"
      Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
      ERROR: Evaluating GetValue("cmi.learner_preference.language") - Expected: "zh-xiang" - LMS Returned: ""
      Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
      ERROR: Evaluating GetValue("cmi.learner_preference.delivery_speed") - Expected: "50.9" - LMS Returned: "1"
      Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"

      NOTE: Many other errors are reported by this test package - this patch only addresses the issues mentioned.

      Show
      It can be tested by running the SCORM Test Harness for DMI package - Data Model Implementation Test 1. 1. Download the DMI Test package. 2. Run the SCORM Test Harness for DMI as specified here - SCORM Test Harness 3. Check the Log to make sure these errors do not show: (for Resumed Activity 1) ERROR: Evaluating GetValue("cmi.progress_measure") - Expected: "0.9" - LMS Returned: "" ERROR: Evaluating GetLastError("") - Expected: "0" - LMS Returned: "403" (for Resumed Activity 4) ERROR: Evaluating GetValue("cmi.learner_preference.audio_level") - Expected: "50.9" - LMS Returned: "1" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" ERROR: Evaluating GetValue("cmi.learner_preference.language") - Expected: "zh-xiang" - LMS Returned: "" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" ERROR: Evaluating GetValue("cmi.learner_preference.delivery_speed") - Expected: "50.9" - LMS Returned: "1" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" NOTE: Many other errors are reported by this test package - this patch only addresses the issues mentioned.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull Master Branch:
      master_MDL-30645
    • Rank:
      33460

      Description

      The default value of the following CMI elements is not computed correctly -

      • cmi.learner_preference.audio_level,
      • cmi.learner_preference.language,
      • cmi.learner_preference.delivery_speed,
      • cmi.learner_preference.audio_captioning,
      • cmi.progress_measure.

      This causes the above elements to have an incorrect value when the SCO is resumed after a suspended state.

        Issue Links

          Activity

          Hide
          Mayank Gupta added a comment -

          Hi,

          This patch -
          https://github.com/mayankgupta/moodle/commit/be054f8e30bc1539800b28437ce0c711dd9a6173

          fixes the evaluation of 'defaultvalue' of cmi.learner_preference.audio_level, cmi.learner_preference.language, cmi.learner_preference.delivery_speed, cmi.learner_preference.audio_captioning, cmi.progress_measure.

          Before applying Patch -
          Resume of Activity 1 - DMI package-

          ERROR: Evaluating GetValue("cmi.progress_measure") - Expected: "0.9" - LMS Returned: ""
          ERROR: Evaluating GetLastError("") - Expected: "0" - LMS Returned: "403"

          Resume of Activity 4 - DMI package-
          ERROR: Evaluating GetValue("cmi.learner_preference.audio_level") - Expected: "50.9" - LMS Returned: "1"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          ERROR: Evaluating GetValue("cmi.learner_preference.language") - Expected: "zh-xiang" - LMS Returned: ""
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          ERROR: Evaluating GetValue("cmi.learner_preference.delivery_speed") - Expected: "50.9" - LMS Returned: "1"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          Evaluating GetValue("cmi.learner_preference.audio_captioning") - Expected: "0" - LMS Returned: "0"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"

          After patch -
          Resume of Activity 1 - DMI package-

          Evaluating GetValue("cmi.progress_measure") - Expected: "0.9" - LMS Returned: "0.9"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"

          Resume of Activity 4 - DMI package-

          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          Evaluating GetValue("cmi.learner_preference.audio_level") - Expected: "50.9" - LMS Returned: "50.9"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          Evaluating GetValue("cmi.learner_preference.language") - Expected: "zh-xiang" - LMS Returned: "zh-xiang"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          Evaluating GetValue("cmi.learner_preference.delivery_speed") - Expected: "50.9" - LMS Returned: "50.9"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"
          Evaluating GetValue("cmi.learner_preference.audio_captioning") - Expected: "0" - LMS Returned: "0"
          Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0"

          NOTE For Integrator - The fix for MDL-30579 should be integrated before integrating this one - otherwise, cmi.progress_measure defaultvalue evaluation would not be fixed.

          Thanks,
          Mayank Gupta.

          Show
          Mayank Gupta added a comment - Hi, This patch - https://github.com/mayankgupta/moodle/commit/be054f8e30bc1539800b28437ce0c711dd9a6173 fixes the evaluation of 'defaultvalue' of cmi.learner_preference.audio_level, cmi.learner_preference.language, cmi.learner_preference.delivery_speed, cmi.learner_preference.audio_captioning, cmi.progress_measure. Before applying Patch - Resume of Activity 1 - DMI package- ERROR: Evaluating GetValue("cmi.progress_measure") - Expected: "0.9" - LMS Returned: "" ERROR: Evaluating GetLastError("") - Expected: "0" - LMS Returned: "403" Resume of Activity 4 - DMI package- ERROR: Evaluating GetValue("cmi.learner_preference.audio_level") - Expected: "50.9" - LMS Returned: "1" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" ERROR: Evaluating GetValue("cmi.learner_preference.language") - Expected: "zh-xiang" - LMS Returned: "" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" ERROR: Evaluating GetValue("cmi.learner_preference.delivery_speed") - Expected: "50.9" - LMS Returned: "1" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" Evaluating GetValue("cmi.learner_preference.audio_captioning") - Expected: "0" - LMS Returned: "0" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" After patch - Resume of Activity 1 - DMI package- Evaluating GetValue("cmi.progress_measure") - Expected: "0.9" - LMS Returned: "0.9" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" Resume of Activity 4 - DMI package- Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" Evaluating GetValue("cmi.learner_preference.audio_level") - Expected: "50.9" - LMS Returned: "50.9" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" Evaluating GetValue("cmi.learner_preference.language") - Expected: "zh-xiang" - LMS Returned: "zh-xiang" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" Evaluating GetValue("cmi.learner_preference.delivery_speed") - Expected: "50.9" - LMS Returned: "50.9" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" Evaluating GetValue("cmi.learner_preference.audio_captioning") - Expected: "0" - LMS Returned: "0" Evaluating GetLastError("") - Expected: "0" - LMS Returned: "0" NOTE For Integrator - The fix for MDL-30579 should be integrated before integrating this one - otherwise, cmi.progress_measure defaultvalue evaluation would not be fixed. Thanks, Mayank Gupta.
          Hide
          Dan Marsden added a comment -

          Thanks Mayank - looks good - NOTE TO INTEGRATOR - MASTER ONLY - SCORM 2004 fixes are only applied to Master branch.

          Show
          Dan Marsden added a comment - Thanks Mayank - looks good - NOTE TO INTEGRATOR - MASTER ONLY - SCORM 2004 fixes are only applied to Master branch.
          Hide
          Aparup Banerjee added a comment -

          Hi Mayank, Dan,
          Sorry this has had conflicts with the current integration, I've tried to have a quick look to resolve this but the code is rather cramped up in there .

          Rather than risk making mistakes, I'm reopening this so that you can submit it next week after resolving those conflicts.
          cheers - Apu

          Show
          Aparup Banerjee added a comment - Hi Mayank, Dan, Sorry this has had conflicts with the current integration, I've tried to have a quick look to resolve this but the code is rather cramped up in there . Rather than risk making mistakes, I'm reopening this so that you can submit it next week after resolving those conflicts. cheers - Apu
          Hide
          Mayank Gupta added a comment -

          Hi Aparup,

          Sorry for the conflict, I believe it is because the patch is expecting line 222 of scorm_13.js.php as -

          'cmi.progress_measure':{'defaultvalue':<?php echo isset($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
          

          but as you have already integrated - MDL-30579 line 222 has been changed to -

          'cmi.progress_measure':{'defaultvalue':<?php echo !empty($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
          

          Apologies - Should have given it a thought earlier, will add the patch to the updated code and start the cycle again.

          Thanks,
          Mayank.

          Show
          Mayank Gupta added a comment - Hi Aparup, Sorry for the conflict, I believe it is because the patch is expecting line 222 of scorm_13.js.php as - 'cmi.progress_measure':{'defaultvalue':<?php echo isset($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':' null ' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'}, but as you have already integrated - MDL-30579 line 222 has been changed to - 'cmi.progress_measure':{'defaultvalue':<?php echo !empty($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':' null ' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'}, Apologies - Should have given it a thought earlier, will add the patch to the updated code and start the cycle again. Thanks, Mayank.
          Hide
          Dan Marsden added a comment -

          hehe - easy to do! - I run into this sort of issue every now and then too - let me know when you've updated and I'll re-submit - thanks Mayank!

          Show
          Dan Marsden added a comment - hehe - easy to do! - I run into this sort of issue every now and then too - let me know when you've updated and I'll re-submit - thanks Mayank!
          Hide
          Mayank Gupta added a comment -

          Hi Dan,
          I have updated the master_MDL-30645 git branch. It should not conflict now. Please resubmit it!

          commit - https://github.com/mayankgupta/moodle/commit/5c10a3215089fd5bd5f8c5f4af144776cd3552b8

          Thanks,
          Mayank Gupta

          Show
          Mayank Gupta added a comment - Hi Dan, I have updated the master_ MDL-30645 git branch. It should not conflict now. Please resubmit it! commit - https://github.com/mayankgupta/moodle/commit/5c10a3215089fd5bd5f8c5f4af144776cd3552b8 Thanks, Mayank Gupta
          Hide
          Aparup Banerjee added a comment -

          Thank Mayank , i've picked that commit into master and 2.2.x. Its up for testing now

          Show
          Aparup Banerjee added a comment - Thank Mayank , i've picked that commit into master and 2.2.x. Its up for testing now
          Hide
          Adrian Greeve added a comment -

          None of the error strings mentioned appeared. Test passed.

          Show
          Adrian Greeve added a comment - None of the error strings mentioned appeared. Test passed.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks!

          Now... disconnect, relax and enjoy the next days, yay!

          Closing...ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks! Now... disconnect, relax and enjoy the next days, yay! Closing...ciao
          Hide
          Mayank Gupta added a comment -

          Thanks Dan, Aparup, Adrian, Eloy for reviewing, resubmitting, integrating, testing and closing this issue.

          -Mayank.

          Show
          Mayank Gupta added a comment - Thanks Dan, Aparup, Adrian, Eloy for reviewing, resubmitting, integrating, testing and closing this issue. -Mayank.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: