'Exit course' overwrites custom score in lms


I have an e-learning in which I track custom score. I report to the lms by a javascript trigger, well known, like:

var player = GetPlayer(); 
//Define new variable for score
var ScoreToLMS = player.GetVar("customScore");
//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(ScoreToLMS, 100, 0);

Scormcloud reports f.i.:

LMSSetValue('cmi.core.score.raw', '12') returned 'true' in 0.001 seconds
LMSSetValue('cmi.core.score.max', '100') returned 'true' in 0 seconds
LMSSetValue('cmi.core.score.min', '0') returned 'true' in 0.001 seconds

A problem arises when I let the user close the e-learning with a button with action 'Exit course'. Then a zero score is sended automatically to the lms.

Scormcloud reports:

LMSSetValue('cmi.core.score.raw', '0') returned 'true' in 0.002 seconds
LMSSetValue('cmi.core.score.max', '100') returned 'true' in 0.001 seconds
LMSSetValue('cmi.core.score.min', '0') returned 'true' in 0 seconds

I think this zero score is from a non-existing quiz and a non-existing results page.

When I let the user close the browser window, this zero score is not sent: scormcloud does not report it.

Anybody can help either closing the window without 'Exit course' or transferring my custom score to a build-in score?

BTW, window.close() does not function in scormcloud, so I refer from that.

Thx for replies!

2 Replies