Updating the LMS with score and status

Feb 23, 2018

Hi community! 

I'm a javascript noob, and I know that Articulate doesn't support javascript issues, so I'm relying on members of the community smarter than me to troubleshoot this! 

The course I built was too complex for standard quiz slides, so I created a variable "TotalScore" that tallies through the course. I want my LMS to have their total score (as a %) and report their status as "complete" only if they get greater than 80%. My final slide includes some javascript that I hope to make my LMS report these custom variables. 

When publishing (HTML5), I have two choices: Track based on slides viewed, and report off a results slide. I don't have a "results slide" because I used this custom variable, and I don't want to track on slides viewed... so I'm not sure which option to select. My solution was to insert a "fake" results slide that isn't "connected" in the course (users never visit it) and use that for reporting/tracking. Then, on my real ending slide, I have a trigger that submits results from this fake slide, then javascript afterward that I hope would override this. What I'm finding when I test is that no score is being sent to the LMS and that it's reporting as "completed", but it's not clear why, since based on my code, I'm not clearing 80%, and based on the fake results slide, there should be no data (no questions associated with it). 

Here's the code I used, much of which I stole from other articles on here: 

var p = GetPlayer();
var cs = p.GetVar("TotalScore");
var ns = 232;
var currentscore = math.round(cs / ns);
var scorepercent = currentscore * 100;

//I have tested this ^ in my browser with an assigned for Total Score and it calculates a percentage, but I haven't tested if it's pulling the variable. 

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);
lmsAPI.SetScore(scorepercent, 100, 0);
if (scorepercent > 79)
{
SetStatus("completed"); }
else {
SetStatus("incomplete");
}

 

In reporting/tracking, I have it set to "completed/incomplete" for publishing, since that's what my LMS (Litmos) uses. 

Any idea what I'm doing wrong? 

Be the first to reply

This discussion is closed. You can start a new discussion or contact Articulate Support.