如何统计SCORM交互数据并计算得分,设置cmi.score的max、min、raw参数
SCORM测验得分计算实现方案
首先明确SCORM标准下得分相关参数的通用规则:
cmi.score.min:得分最小值,常规测验场景统一设为0即可cmi.score.max:得分最大值,你当前单题满分100的场景直接填100,多题场景填所有题目的总分即可cmi.score.raw:用户实际获得的原始分,你的场景下答题正确取100、错误取0即可,多题场景按单题分值累加计算后填入
修改后的完整代码
submitMCQ(correct, response) { let nextIndex = SCORM.get("cmi.interactions._count", true); // 记录交互基础信息 SCORM.set("cmi.interactions." + nextIndex + ".id", "round_" + nextIndex); SCORM.set("cmi.interactions." + nextIndex + ".type", "choice"); SCORM.set("cmi.interactions." + nextIndex + ".student_response", response); SCORM.set("cmi.interactions." + nextIndex + ".result", correct); // 得分计算与写入逻辑 const fullScore = 100; let rawScore = 0; // 兼容correct字段为布尔值或"correct"/"incorrect"字符串两种场景 if (correct === true || correct?.toLowerCase() === 'correct') { rawScore = fullScore; } // 写入SCORM得分字段 SCORM.set("cmi.score.min", 0); SCORM.set("cmi.score.max", fullScore); SCORM.set("cmi.score.raw", rawScore); // 可选:写入缩放得分(取值范围0-1,部分LMS平台用于统计通过率) // SCORM.set("cmi.score.scaled", rawScore / fullScore); // 提交数据到LMS避免丢失 SCORM.save(); }
补充注意事项
- 后续拓展多题场景时,只需维护全局总得分变量,每次答题后累加对应单题得分,最后统一写入
cmi.score.raw、同步修改cmi.score.max为总分即可 - 绝大多数LMS要求得分更新后必须调用
SCORM.save()才会同步数据,建议每次修改得分字段后都调用一次
内容的提问来源于stack exchange,提问作者lache
相关产品推荐
相关产品推荐

