Failed status not reported to Moodle
May 14, 2020
Hello!
I have created a small game in Storyline 3 (version: 3.9). I have used Javascript in the last slide to send the score and status to Moodle LMS( version: 3.8.2+).
The score is recorded properly, but the status is always set to Passed.
Here is the JS code:
var player = GetPlayer();
//Get LMS API
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(player.GetVar("Score"), 100, 0);
if (player.GetVar("Score")>= 50)
{
SetStatus("passed");
} else {
SetStatus("failed");
}
I have also tried changing the code. It's still the same.
No matter what I change during publish, it cannot updated the correct status to Failed. It always sets the status to Passed.
I have used the following settings:
I have changed the LMS Reporting settings to different combinations, but it wouldn't work.
Any help will be appreciated.
Thanks
11 Replies
Is there any solution?
I also tested it in SCORM Cloud. same issue.
I even created a simple, new 2 blank slides with the javascript to test it if there was any issue with the game. But it's the same thing. I guess the syntax is not correct in this part -
if (player.GetVar("Score")>= 50)
{
SetStatus("passed");
} else {
SetStatus("failed");
}
The score is getting passed to the LMS or Scorm cloud.
Also, I tried with this JS code:
/*Get player to reference*/
var player = GetPlayer();
/*get LMS API*/
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);
/*set score; the first number is the score*/
lmsAPI.SetScore(player.GetVar("score"), 100, 0);
/*set status; possible values: "completed","incomplete", "failed", "passed"*/
if (player.GetVar("score")>= player.GetVar("passingpercentage"))
{
SetStatus("passed");
}
else
{
SetStatus("failed");
}
I also tried with SCORM 2004 - 4th Edition
You need to ensure that storyline cannot overwrite your competition. So report on slides viewed but ensure the user cannot meet the reqiurement or a completion trigger that they cannot reach
Okay. Do you mean that there should be one extra slide which will be hidden and not included in Track using slides viewed?
I tested with Storyline 2 using this JS and it worked fine. It sent a failed status if the score was less.
So, I guess something has changed in Storyline 3.
/*Get player to reference*/
var player = GetPlayer();
/*get LMS API*/
var lmsAPI = parent;
/*set score; the first number is the score*/
lmsAPI.SetScore(player.GetVar("score"), 100, 0);
/*set status; possible values: "completed","incomplete", "failed", "passed"*/
if (player.GetVar("score")>= player.GetVar("passingpercentage"))
{
SetStatus("passed");
}
else
{
SetStatus("failed");
}
Have you checked the console for errors, it could be the course is losing inside an iframe so is not getting the lmsAPI
But it can pass the score to the LMS.
If there was issue with lmAPI, then it could not have sent the score as well.
I have not checked the console for errors. As I said, it's the same thing even with SCORM Cloud.
If the score is being sent then status should work, check the console for any errors. Then ensure storyline cannot overwrite the status when it is being closed
How can I do that?
I have included the JS in the last slide on timeline start.
I got the solution from this post. It's at the end.
https://community.articulate.com/discussions/articulate-storyline/scorm-send-completed-status-to-moodle-lms
SCORM 1.2:
//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(90, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
//set status; possible values: "completed","passed", "icomplete", "failed"
SCORM_CallLMSSetValue("cmi.core.lesson_status", "complete");
SCORM 2004:
//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(90, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
SCORM2004_CallSetValue("cmi.completion_status", "completed");
SCORM2004_CallSetValue("cmi.success_status", "passed");
This discussion is closed. You can start a new discussion or contact Articulate Support.