scormscorm2004scorm1.2

Why the passed score is not storing in SCORM Cloud for SCORM 2004 3rd edition?


I launched the SCORM 2004(3rd edition) package in SCORM Cloud. I passed the exam of 80%, but the results are not stored. I attached the Sandbox Registration State results.

Satisfied: true
**Completed: unknown**
Progress Status: true
Attempts: 1
Suspended: true
Activity Objective #1
    Id:
    Measure Status: false
    **Normalized Measure: unknown**
    Progress Measure: true
    Satisfied Status: true
Runtime Data
    **cmi.completion_status: unknown**
    cmi.credit: Credit
    cmi.entry: Resume
    cmi.exit: Suspend
    cmi.learner_preference
        cmi.learner_preference.audio_level: 1
        cmi.learner_preference.language:
        cmi.learner_preference.delivery_speed: 1
        cmi.learner_preference.audio_captioning: 0
    **cmi.location: 2_8
    cmi.mode: Normal
    cmi.progress_measure:
    cmi.score_scaled:
    cmi.score_raw: 80**
    cmi.score_min:
    cmi.score_max:
    **cmi.total_time: 0000:00:28**
    Total Time Tracked by SCORM Engine: 0000:00:29.12
    cmi.success_status: Passed
    cmi.suspend_data:
    Static Data
        cmi.completion_threshold:
        cmi.launch_data:
        cmi.learner_id: test@domain.com
        cmi.learner_name: Test Test
        cmi.max_time_allowed:
        cmi.scaled_passing_score:
        cmi.time_limit_action: Undefined

When I tried with the same course in SCORM 1.2 version, I can see all the results in SCORM cloud. I don't know, what is the issue on this.

Here, I attached the script also,

function getResults(correct_count, answers_key, total, grade) {
        var form_result = $('form').serializeArray();
        $.each(form_result, function(i, val) {
            if(answers_key[i] == val.value) {
                correct_count += 1; 
            }
        });
        var score = Math.round(parseFloat(parseFloat(correct_count, 10) * 100)/ parseFloat(total, 10));

        setScore(score);
        if(score >= grade) {
            setPassFail('passed');
        } else {
            setPassFail('failed');
        }
    }


    function setPassFail(sPassFail) {
        /* see if this SCORM 2004 */
        if (_sAPI == "API_1484_11") {
            /* it is SCORM 2004, set the success status */
            scormSetValue("cmi.success_status", sPassFail+"");
        } else if (_sAPI == "API") {
            /* it is SCORM 1.2,set the completion status */
            scormSetValue("cmi.core.lesson_status", sPassFail+"");
        }
    }

    function setScore(sScore) {     /* see if this SCORM 2004 */    if (_sAPI == "API_1484_11") {       /* it is SCORM 2004, set the scaled score data */ //        scormSetValue("cmi.score.scaled", sScore+"");       scormSetValue("cmi.score.raw", sScore+"");      scormCommit();  } else if (_sAPI == "API") {        /* it is SCORM 1.2, set the min and max scores
*/      scormSetValue("cmi.core.score.raw", sScore+"");     } }
    function scormSetValue(name, value) {
        var API = getAPI();
        if (API == null)
            return "true";

        /* call the correct SCORM function */
        if (_sAPI == "API")
            var result = API.LMSSetValue(name, value);
        else
            var result = API.SetValue(name, value);
        return result;
    } 

function scormCommit() {
    var API = getAPI();
    if (API == null)
        return "false";

    /* call the correct SCORM function */
    if (_sAPI == "API")
        var result = API.LMSCommit("");
    else
        var result = API.Commit("");
    return result;
}

Please help me, what is the mistake/issue is there in the code.

Thanks!

Hi, I made all the changes and got the results in SCORM Cloud. But I didn't get the Overall Score for the course. Is there any thing i want to add?

enter image description here


Solution

  • I got the fix for the issues as per your guidance and did some R&D myself with code.

    1) Updated few namespace and its values: using the namesapce "completion_status" instead of "success_status" in all the places.

    Ex:

    function setPassFail(sPassFail) {
        /* see if this SCORM 2004 */
        if (_sAPI == "API_1484_11") {
            /* it is SCORM 2004, set the success status */
    //      scormSetValue("cmi.success_status", sPassFail+"");
            scormSetValue("cmi.completion_status", sPassFail+"");
        } else if (_sAPI == "API") {
            /* it is SCORM 1.2,set the completion status */
            scormSetValue("cmi.core.lesson_status", sPassFail+"");
        }
    }
    

    2) Added supporting namespaces: calculated the percentage values from the Score and passed it in "cmi.score.scaled" namespace and additionally added "cmi.score.raw" namespace as per your guidance.

    function setScore(sScore) {
        /* see if this SCORM 2004 */
        if (_sAPI == "API_1484_11") {
            /* it is SCORM 2004, set the scaled score data */
    //      scormSetValue("cmi.score.scaled", sScore+"");
            var scaled_score = (sScore / 100);
            scormSetValue("cmi.score.scaled", scaled_score+"");
            scormSetValue("cmi.score.raw", sScore+"");
            scormCommit();
        } else if (_sAPI == "API") {
            /* it is SCORM 1.2, set the min and max scores */
            scormSetValue("cmi.core.score.raw", sScore+"");
        }
    }
    

    3) Finally, added the score.min and score.max values and calculated the grede:

    function getResults(correct_count, answers_key, total, grade) {
            var form_result = $('form').serializeArray();
            $.each(form_result, function(i, val) {
                if(answers_key[i] == val.value) {
                    correct_count += 1; 
                }
            });
            var score = Math.round(parseFloat(parseFloat(correct_count, 10) * 100)/ parseFloat(total, 10));
    
            setScore(score);
            scormSetValue("cmi.score.min", "0");
            scormSetValue("cmi.score.max", "100");
    
            if(score >= grade) {
              //setPassFail('passed');
                var sPassFail = 'passed';
                scormSetValue("cmi.completion_status", sPassFail+"");
                scormSetValue("cmi.success_status", sPassFail+"");
                setPassFail('completed');
            } else {
                //setPassFail('failed');
                var sPassFail = 'passed';
                scormSetValue("cmi.completion_status", sPassFail+"");
                scormSetValue("cmi.success_status", sPassFail+"");
                setPassFail('incomplete');
            }
        }
    

    Thank you for your help, friends!