Moodle
  1. Moodle
  2. MDL-18023

Get cmi.core.score.raw returns an empty string

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.8.9, 1.9.5
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      Production : Ubuntu Server, Linux capturator 2.6.15-52-server, PHP Version 5.1.2, MySQL 5.0.22
      Tested also on Windows XP PHP Version 5.2.1 MySQL: 5.0.27
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      31572

      Description

      If a student get a score equal to zero and complete the attempt, moodle do not register it and when in the next attempt the SCOtry to retrieve this data (doLMSGetValue( "cmi.core.score.raw") )it gets an empty string.

      The SCORM RunTime Environment allows the return of an empty string but only if there wasn't a previous attempt or the previous attempt didn't set it. (page 36 SCORM 1.2 RTE cmi.core.score.raw definition - "Usage")

      Here an exemple, this is the copy of the trace from SCORM API debbuger,

      First Attempt O get 0
      Fri, 23 Jan 2009 13:10:37 UTC: LMSSetValue("cmi.core.lesson_status", "failed") => 0
      Fri, 23 Jan 2009 13:10:37 UTC: LMSSetValue("cmi.suspend_data", "") => 0
      Fri, 23 Jan 2009 13:10:37 UTC: LMSSetValue("cmi.core.score.raw", "0") => 0

      Second attempt I set 13 , try to get previouse score : 0 should be retrieved but empty string returned

      Fri, 23 Jan 2009 13:22:59 UTC: LMSGetValue("cmi.core.lesson_mode") - review => 0
      Fri, 23 Jan 2009 13:22:59 UTC: LMSGetValue("cmi.core.lesson_status") - failed => 0
      Fri, 23 Jan 2009 13:22:59 UTC: LMSGetValue("cmi.core.score.raw") - => 0 ====HERE THE PROBLEM=========
      Fri, 23 Jan 2009 13:22:59 UTC: LMSSetValue("cmi.core.score.raw", "13") => 0

      Third attempt i get 13 (it's ok!)

      Fri, 23 Jan 2009 13:23:57 UTC: LMSGetValue("cmi.core.lesson_mode") - review => 0
      Fri, 23 Jan 2009 13:23:57 UTC: LMSGetValue("cmi.core.lesson_status") - failed => 0
      Fri, 23 Jan 2009 13:23:57 UTC: LMSGetValue("cmi.core.score.raw") - 13 => 0

        Activity

        Hide
        Dan Marsden added a comment -

        Hi there,

        thanks for the really good quality report! - we haven't got a lot of time at the moment, but this sounds like it could be a simple fix! - we will try to look at this soon!

        thanks,

        Dan

        Show
        Dan Marsden added a comment - Hi there, thanks for the really good quality report! - we haven't got a lot of time at the moment, but this sounds like it could be a simple fix! - we will try to look at this soon! thanks, Dan
        Hide
        Dan Marsden added a comment -

        Piers - I've tested this and can't reproduce it :
        Wed, 04 Feb 2009 01:39:35 GMT: LMSInitialize("", "") => 0
        Wed, 04 Feb 2009 01:39:49 GMT: LMSSetValue("cmi.core.score.raw", "0") => 0
        Wed, 04 Feb 2009 01:39:49 GMT: LMSGetErrorString("0", "No error") => 0
        Wed, 04 Feb 2009 01:39:53 GMT: LMSGetValue("cmi.core.score.raw") - 0 => 0
        Wed, 04 Feb 2009 01:39:53 GMT: LMSGetErrorString("0", "No error") => 0

        any ideas?

        Show
        Dan Marsden added a comment - Piers - I've tested this and can't reproduce it : Wed, 04 Feb 2009 01:39:35 GMT: LMSInitialize("", "") => 0 Wed, 04 Feb 2009 01:39:49 GMT: LMSSetValue("cmi.core.score.raw", "0") => 0 Wed, 04 Feb 2009 01:39:49 GMT: LMSGetErrorString("0", "No error") => 0 Wed, 04 Feb 2009 01:39:53 GMT: LMSGetValue("cmi.core.score.raw") - 0 => 0 Wed, 04 Feb 2009 01:39:53 GMT: LMSGetErrorString("0", "No error") => 0 any ideas?
        Hide
        Dan Marsden added a comment -

        Marco - could you please give the full output from the scorm API Log rather than just the bits regarding score.raw?

        thanks,

        Show
        Dan Marsden added a comment - Marco - could you please give the full output from the scorm API Log rather than just the bits regarding score.raw? thanks,
        Hide
        Piers Harding added a comment -

        Yeah Dan - I think I have tracked this down. I have a patch for this when the weekly review is up.

        line 542 of scorm_12.js.php:
        if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property] || eval('typeof(datamodel["'+elementmodel+'"].defaultvalue)') != typeof(data[property])) {

        It may even be browser specific, in that you need to test the type, and the contents.

        Cheers,
        Piers.

        Show
        Piers Harding added a comment - Yeah Dan - I think I have tracked this down. I have a patch for this when the weekly review is up. line 542 of scorm_12.js.php: if (eval('datamodel ["'+elementmodel+'"] .defaultvalue') != data [property] || eval('typeof(datamodel ["'+elementmodel+'"] .defaultvalue)') != typeof(data [property] )) { It may even be browser specific, in that you need to test the type, and the contents. Cheers, Piers.
        Hide
        Dan Marsden added a comment -

        cool! - assigning to Piers!

        Show
        Dan Marsden added a comment - cool! - assigning to Piers!
        Hide
        Marco Loche added a comment -

        Ok, I've tested the patch and it works!
        (in my config: Windows XP PHP Version 5.2.1 MySQL: 5.0.27 Browser IE7)

        Here the full trace from the API debugger with the patch applied:

        Wed, 4 Feb 2009 09:23:16 UTC: Moodle SCORM 1.2 API Loaded, Activity: module 2, SCO: ITEM-5C03AE70-9B2A-2912-1312-9295286D67DB
        Wed, 4 Feb 2009 09:23:28 UTC: LMSInitialize("", "") => 0
        Wed, 4 Feb 2009 09:23:28 UTC: LMSGetValue("cmi.core.student_id") - admin => 0
        Wed, 4 Feb 2009 09:23:41 UTC: LMSGetValue("cmi.core.lesson_status") - not attempted => 0
        Wed, 4 Feb 2009 09:23:41 UTC: LMSSetValue("cmi.core.lesson_status", "incomplete") => 0
        Wed, 4 Feb 2009 09:23:41 UTC: LMSGetValue("cmi.core.lesson_location") - => 0
        Wed, 4 Feb 2009 09:23:41 UTC: LMSGetValue("cmi.suspend_data") - => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.session_time", "00:00:29.75") => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.lesson_location", "5") => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.core.lesson_mode") - normal => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.core.lesson_status") - incomplete => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.core.score.raw") - => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.lesson_status", "failed") => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.suspend_data", "") => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.score.raw", "0") => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.comments") - => 0
        Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.comments", "[Attempt:1,Date:Wed Feb 04 10:24:11 2009,Status:Failed,Score:0,Time:00:00:29.75]- ") => 0
        Wed, 4 Feb 2009 09:24:12 UTC: Commit("", "") => 0
        Wed, 4 Feb 2009 09:24:13 UTC: LMSFinish("", "") => 0
        Wed, 4 Feb 2009 09:24:23 UTC: Moodle SCORM 1.2 API Loaded, Activity: module 2, SCO: ITEM-5C03AE70-9B2A-2912-1312-9295286D67DB
        Wed, 4 Feb 2009 09:24:27 UTC: LMSInitialize("", "") => 0
        Wed, 4 Feb 2009 09:24:27 UTC: LMSGetValue("cmi.core.student_id") - admin => 0
        Wed, 4 Feb 2009 09:24:27 UTC: LMSGetValue("cmi.launch_data") - #ACS#8caa72dc065e3bdaadbf7d799ff81f44#ACE# => 0
        Wed, 4 Feb 2009 09:24:29 UTC: LMSGetValue("cmi.core.lesson_status") - failed => 0
        Wed, 4 Feb 2009 09:24:29 UTC: LMSGetValue("cmi.core.lesson_location") - 5 => 0
        Wed, 4 Feb 2009 09:24:29 UTC: LMSGetValue("cmi.suspend_data") - => 0
        Wed, 4 Feb 2009 09:25:55 UTC: LMSSetValue("cmi.core.session_time", "00:01:26.67") => 0
        Wed, 4 Feb 2009 09:25:55 UTC: LMSSetValue("cmi.core.lesson_location", "5") => 0
        Wed, 4 Feb 2009 09:25:55 UTC: LMSGetValue("cmi.core.lesson_mode") - review => 0
        Wed, 4 Feb 2009 09:25:56 UTC: LMSGetValue("cmi.core.lesson_status") - failed => 0
        Wed, 4 Feb 2009 09:25:56 UTC: LMSGetValue("cmi.core.score.raw") - 0 => 0 =========== GREAT! IT WORKS ==============
        Wed, 4 Feb 2009 09:25:56 UTC: LMSSetValue("cmi.core.score.raw", "14") => 0
        Wed, 4 Feb 2009 09:25:56 UTC: LMSGetValue("cmi.comments") - [Attempt:1,Date:Wed Feb 04 10:24:11 2009,Status:Failed,Score:0,Time:00:00:29.75]- => 0
        Wed, 4 Feb 2009 09:25:56 UTC: LMSSetValue("cmi.comments", "[Attempt:1,Date:Wed Feb 04 10:24:11 2009,Status:Failed,Score:0,Time:00:00:29.75]- [Attempt:2,Date:Wed Feb 04 10:25:55 2009,Status:Failed,Score:14,Time:00:01:26.67]- ") => 0
        Wed, 4 Feb 2009 09:25:56 UTC: LMSSetValue("cmi.suspend_data", "") => 0
        Wed, 4 Feb 2009 09:25:56 UTC: Commit("", "") => 0
        Wed, 4 Feb 2009 09:25:57 UTC: LMSFinish("", "") => 0

        Show
        Marco Loche added a comment - Ok, I've tested the patch and it works! (in my config: Windows XP PHP Version 5.2.1 MySQL: 5.0.27 Browser IE7) Here the full trace from the API debugger with the patch applied: Wed, 4 Feb 2009 09:23:16 UTC: Moodle SCORM 1.2 API Loaded, Activity: module 2, SCO: ITEM-5C03AE70-9B2A-2912-1312-9295286D67DB Wed, 4 Feb 2009 09:23:28 UTC: LMSInitialize("", "") => 0 Wed, 4 Feb 2009 09:23:28 UTC: LMSGetValue("cmi.core.student_id") - admin => 0 Wed, 4 Feb 2009 09:23:41 UTC: LMSGetValue("cmi.core.lesson_status") - not attempted => 0 Wed, 4 Feb 2009 09:23:41 UTC: LMSSetValue("cmi.core.lesson_status", "incomplete") => 0 Wed, 4 Feb 2009 09:23:41 UTC: LMSGetValue("cmi.core.lesson_location") - => 0 Wed, 4 Feb 2009 09:23:41 UTC: LMSGetValue("cmi.suspend_data") - => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.session_time", "00:00:29.75") => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.lesson_location", "5") => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.core.lesson_mode") - normal => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.core.lesson_status") - incomplete => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.core.score.raw") - => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.lesson_status", "failed") => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.suspend_data", "") => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.core.score.raw", "0") => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSGetValue("cmi.comments") - => 0 Wed, 4 Feb 2009 09:24:11 UTC: LMSSetValue("cmi.comments", " [Attempt:1,Date:Wed Feb 04 10:24:11 2009,Status:Failed,Score:0,Time:00:00:29.75] - ") => 0 Wed, 4 Feb 2009 09:24:12 UTC: Commit("", "") => 0 Wed, 4 Feb 2009 09:24:13 UTC: LMSFinish("", "") => 0 Wed, 4 Feb 2009 09:24:23 UTC: Moodle SCORM 1.2 API Loaded, Activity: module 2, SCO: ITEM-5C03AE70-9B2A-2912-1312-9295286D67DB Wed, 4 Feb 2009 09:24:27 UTC: LMSInitialize("", "") => 0 Wed, 4 Feb 2009 09:24:27 UTC: LMSGetValue("cmi.core.student_id") - admin => 0 Wed, 4 Feb 2009 09:24:27 UTC: LMSGetValue("cmi.launch_data") - #ACS#8caa72dc065e3bdaadbf7d799ff81f44#ACE# => 0 Wed, 4 Feb 2009 09:24:29 UTC: LMSGetValue("cmi.core.lesson_status") - failed => 0 Wed, 4 Feb 2009 09:24:29 UTC: LMSGetValue("cmi.core.lesson_location") - 5 => 0 Wed, 4 Feb 2009 09:24:29 UTC: LMSGetValue("cmi.suspend_data") - => 0 Wed, 4 Feb 2009 09:25:55 UTC: LMSSetValue("cmi.core.session_time", "00:01:26.67") => 0 Wed, 4 Feb 2009 09:25:55 UTC: LMSSetValue("cmi.core.lesson_location", "5") => 0 Wed, 4 Feb 2009 09:25:55 UTC: LMSGetValue("cmi.core.lesson_mode") - review => 0 Wed, 4 Feb 2009 09:25:56 UTC: LMSGetValue("cmi.core.lesson_status") - failed => 0 Wed, 4 Feb 2009 09:25:56 UTC: LMSGetValue("cmi.core.score.raw") - 0 => 0 =========== GREAT! IT WORKS ============== Wed, 4 Feb 2009 09:25:56 UTC: LMSSetValue("cmi.core.score.raw", "14") => 0 Wed, 4 Feb 2009 09:25:56 UTC: LMSGetValue("cmi.comments") - [Attempt:1,Date:Wed Feb 04 10:24:11 2009,Status:Failed,Score:0,Time:00:00:29.75] - => 0 Wed, 4 Feb 2009 09:25:56 UTC: LMSSetValue("cmi.comments", " [Attempt:1,Date:Wed Feb 04 10:24:11 2009,Status:Failed,Score:0,Time:00:00:29.75] - [Attempt:2,Date:Wed Feb 04 10:25:55 2009,Status:Failed,Score:14,Time:00:01:26.67] - ") => 0 Wed, 4 Feb 2009 09:25:56 UTC: LMSSetValue("cmi.suspend_data", "") => 0 Wed, 4 Feb 2009 09:25:56 UTC: Commit("", "") => 0 Wed, 4 Feb 2009 09:25:57 UTC: LMSFinish("", "") => 0
        Hide
        Piers Harding added a comment -

        commited the fix and backported to 1.9, and 1.8.

        Thanks for following up the testing.

        Cheers,
        Piers Harding.

        Show
        Piers Harding added a comment - commited the fix and backported to 1.9, and 1.8. Thanks for following up the testing. Cheers, Piers Harding.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: