Forum Discussion
Submit Final Score to LMS Without Using Results Screen
Hi Thomas.
I've been experimenting with trying a similar thing recently and found some help on a few different threads, so I'll try to pass on what I've learned.
If it's just the final score and a completion status you need to be reported to the LMS then you should be able to achieve that with some JavaScript code. I think you'll need to set your completion tracking to either 'Track using number of slides viewed' or 'Track using complete course trigger' though. When you have it set to 'Track using quiz result' the JavaScript code will be overwritten by the built-in passed/failed status.
Here's the code that may work. I'm a novice when it comes to JavaScript, but this is what I found on other threads here and it's worked when I've tested it:
var p = GetPlayer();
var passingScore = [enter the passing score here];
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var TOTALScore = p.GetVar("TOTALScore");
p.SetVar("TOTALScore", TOTALScore );
lmsAPI.SetScore(TOTALScore, [enter the maximum score here], [enter the minimum score here]);
if (player.GetVar("TOTALScore")>= passingScore)
{
SetStatus("passed");
} else {
SetStatus("failed");
}
As I say, I don't know much about JavaScript, so that may not be entirely right, but it should be a good starting point. If anything's not working I'm sure some of the more code-savy members can help.
EDIT: The above is based on your total score just being a number rather than a percentage. If it's a percentage you'll need some extra code, which I think I can provide if needed.