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

时间:2016-04-25 05:58:50

标签: scorm scorm2004 scorm1.2

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

请帮助我,代码中有什么错误/问题。

谢谢!

您好, 我做了所有的更改,并在SCORM Cloud中得到了结果。但是我没有得到该课程的总分。有什么我想补充的吗?

enter image description here

3 个答案:

答案 0 :(得分:2)

要根据API保存数据集,您必须调用API.Commit('')API.LMSCommit('')以保存学生尝试数据。

我会从那里开始。提交数据可以通过导航按钮(如保存按钮)完成,但您也可以在终止SCO之前完成。有些甚至在页面转弯时或每2分钟自动保存一次。

答案 1 :(得分:1)

我根据你的指导得到了问题的解决方案,并自己做了一些研发代码。

1)更新了几个名称空间及其值: 使用namesapce" 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');
        }
    }

谢谢你的帮助,朋友们!

答案 2 :(得分:0)

Mark对cmi.score.score.raw的回答很重要,SCORM 2004版本是否缺少提交语句?

此外,您的1.2代码使用cmi.score.scaled,而您的2004代码使用scaledraw不一定是cmi.score.raw的替代品,我建议在SCORM 2004中坚持使用cmi.score.scaled,除非您真正了解使用cmi.progress_measure的内容。 (cmi.score.scaled,您的清单可能对 class getuser extends AsyncTask<String, String, String> { protected String doInBackground(String... args) { int success; try { List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("ID", ID)); JSONObject json = jsonParser.makeHttpRequest(url_user_detials, "GET", params); Log.d("Single user Details", json.toString()); success = json.getInt(TAG_SUCCESS); if (success == 1) { JSONArray userObj = json.getJSONArray("user"); JSONObject user = userObj.getJSONObject(0); String ln = user.getString("longg"); String lt = user.getString("latt"); String fn = user.getString("fname"); String lna = user.getString("lname"); String ph = user.getString("phone"); username=fn+" "+lna; userphone=ph+""; userlat= Double.parseDouble(lt); userlong= Double.parseDouble(ln); marker = new MarkerOptions().position(new LatLng(userlat, userlong)); marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)); map.addMarker(marker); } else { } } catch (JSONException e) { e.printStackTrace(); } return null; } 等产生的影响。)