Forum Discussion
SCORM/xAPI not passing grade to Brightspace (D2L) gradebook
After a day trying #1, we've failed to successfully pass a grade through a Rise SCORM object via Storyline (tested using https://app.cloud.scorm.com/).
Further suggestions would be appreciated.
- Tim_10 months agoCommunity Member
Hi
In my attached course, I’ve tried to set the score using the code from above inside a storyline object. This worked for my own scorm test harness, but not in scorm cloud. Not sure why.
I then tried changing tack. I modified the ./scormdriver/scormdriver.js file to emit an event when SetValue is called so that it’s easier to add custom logic. I then added a script block right before the closing </body> tag to the ./scormdriver/indexAPI.html file that detects the lesson_completed state and also sets a score.
<script>
/* custom event handler for SCORM_CallLMSSetValue */
window.addEventListener('lmssetvalue', function(e) {
const {api,key,value} = e.detail;
switch (key) {
case "cmi.core.lesson_status":
if (value == "completed" || value == "passed") {
console.info('heard lesson_status completed or passed, setting score');
// set the score to 100
api.LMSSetValue("cmi.core.score.raw", "100");
api.LMSSetValue("cmi.core.score.min", "0");
api.LMSSetValue("cmi.core.score.max", "100");
console.info(api.LMSCommit(""));
}
break;
}
});
</script>On scorm cloud, the score is set to 100% when the course completes.
Does this help?