为什么通过的分数没有存储在 SCORM 2004 第 3 版的 SCORM Cloud 中?

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

我在 SCORM Cloud 中启动了 SCORM 2004(第 3 版)包。我通过了 80% 的考试,但没有存储结果。我附上了沙盒注册状态结果。

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

当我在 SCORM 1.2 版本中尝试使用相同的课程时,我可以在 SCORM 云中看到所有结果。我不知道,这是什么问题。

在这里,我也附上了脚本,

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;
}

请帮助我,代码中的 mistake/issue 是什么。

谢谢!

你好, 我进行了所有更改并在 SCORM Cloud 中获得了结果。但是我没有得到课程的总分。我有什么要补充的吗?

为了保存针对 API 的数据集,您必须调用 API.Commit('')API.LMSCommit('') 以保存学生尝试数据。

我会从那里开始。提交数据可以通过导航按钮(如保存按钮)完成,但您也可以在终止 SCO 之前立即进行。有些人甚至在翻页时这样做,或者喜欢每 2 分钟自动保存一次。

Mark API.Commit() 的回答很重要,SCORM 2004 版本是否缺少提交语句?

此外,您的 1.2 代码使用 cmi.score.score.raw,而您的 2004 代码使用 cmi.score.scaledscaled 不一定是 raw 的直接替代品,我建议在 SCORM 2004 中坚持使用 cmi.score.raw,除非您真正了解使用 cmi.score.scaled 的意义。 (cmi.progress_measure,您的清单对 cmi.score.scaled 的影响等)

我按照您的指导修复了问题,并自己用代码进行了一些研发。

1) 更新了几个命名空间及其值: 在所有地方使用命名空间 "completion_status" 而不是 "success_status"。

例如:

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) 添加了支持的命名空间: 从分数中计算百分比值并将其传递到 "cmi.score.scaled" 命名空间,并根据您的需要添加 "cmi.score.raw" 命名空间指导。

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) 最后,添加score.min和score.max值并计算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');
        }
    }

谢谢朋友们的帮助!