CC_StoreQuizResult gets called twice

Feb 11, 2011

I'm putting a quiz into Lectora & am trying to trap the score so I can do some branching in the course. I noticed that when I placed alert(arrArgs[1]) in the CC_StoreQuizResult function of the quiz.js file, it gets called twice at the conclusion of the quiz. Any idea why this would be happening?

It seems to me that it should only get called once to report the final quiz score. I just started looking at it so I might be missing something somewhere.

Thanks

12 Replies
Brian Batt

Hi Jeff,

Instead of putting an alert in the quiz.js file, you should be using the method below to initiate a debug log:

http://www.articulate.com/support/presenter09/kb/?p=936

Although the article mentions Presenter, the same process applies to Quizmaker.  This debug log will give you a better idea of exactly what is being sent to the LMS.

Jeff Kettler

Thanks, but in my case I'm not publishing for LMS because I don't want Quizmaker reporting anything to the LMS. I need to capture the score before it get's reported, and then if they pass, I manually set the AICC Lesson Status to completed and send the score to the LMS. If they fail, I'm sending them back to the quiz for up to 2 more retries. If they fail after the 3rd try, they fail the course.

We're giving them a different message depending on whether it's the 1st, 2nd, or 3rd time through the quiz. It's my first time using Quizmaker so I'm trying to learn what the functions in the quiz.js file do. I can code a workaround so my function ignores the second time CC_StoreQuizResult is sent. I just found it odd that it was getting called twice at the end of the quiz.

Michael Couillard

Same problem here - plus another: if the last question on the last slide is answered incorrectly, CC_StoreQuizResult is called. When the user tries to answer the question again - we allow another try for every question - CC_StoreQuizResult is called again.

Then the original problem discussed happens on the final slide - CC_StoreQuizResult is called twice. Total calls of your method: 3.

If the user answers the last question correctly, the only problem is the duplicate call to CC_StoreQuizResult. Since the resulting score is the same, this specific problem can be worked around.

But calling CC_StoreQuizResult when answering incorrectly BEFORE the quiz is actually complete? That one I can't work around.

Articulate code is calling CC_StoreQuizResult. I track this using Firebug. This procedure is called errantly. Regardless of what we do after or within this procedure... there's 2 bugs in your (Flash?) code that calls this JS code.

Can this be investigated?

Affected versions:

3.0.901.713

3.3.1103.112

Version that works OK:

2.10.045

Michael Couillard

Certainly, the filename is "quiz.js" and here are the important bits:

/********************************************************/

// Chico.js

/********************************************************/

// Results Screen vars

var g_strPlayer = "chico";

var g_arrResults = new Array();

var g_oQuizResults = new Object();

g_oQuizResults.oOptions = new Object();

// Browser Sniffing

var IE =  ((document.all)&&(navigator.appVersion.indexOf("MSIE")!=-1))    ? true : false;

var IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;

var FF = (navigator.userAgent.indexOf("Firefox")!=-1) ? true : false;

var Opera = (navigator.userAgent.indexOf("Opera")!=-1) ? true : false;

var IESP2 = ((window.navigator.userAgent.indexOf("MSIE")) && window.navigator.userAgent.indexOf("SV1") > window.navigator.userAgent.indexOf("MSIE"));

var Safari3 =  (navigator.appVersion.indexOf("Safari") && navigator.appVersion.indexOf("Version/3"));

var NS6plus = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;

var NS7_2Plus = false;

var Mozilla1_7Plus = false;

var g_bLMSPresent = false;

...
-----------------
...
function player_DoFSCommand(command, args) 
{
args = String(args);
command = String(command);
var arrArgs = args.split(g_strDelim);
switch (command)
...
-------------------------------
...
case "CC_StoreQuizResult":
g_oQuizResults.dtmFinished = new Date();
g_oQuizResults.strResult = arrArgs[0];
g_oQuizResults.strScore = arrArgs[1];
g_oQuizResults.strPassingScore = arrArgs[2];
g_oQuizResults.strMinScore = arrArgs[3];
g_oQuizResults.strMaxScore = arrArgs[4];
g_oQuizResults.strPtScore = arrArgs[5];
g_oQuizResults.strPtMax = arrArgs[6];
g_oQuizResults.strTitle = arrArgs[7];
          console.debug(CC_StoreQuizResult,g_oQuizResults); //use this to debug in FF
break;
...
-----------------------

That last block has the only custom change to your JS file for the simple purpose of bug reproduction. Using that I'm able to see that this code within the player_DoFSCommand function is called inappropriately.
Also, here's the HTML header of of "quiz.html" so you can see what program generated this:
var g_bLMS = false;
var g_bAOSupport = false;
var g_strContentFolder = "quiz_content";
Brian Batt

Hi Michael,

Can you tell me what is happening in your LMS that is a problem?  Regardless of how many times we "storequizresult", we only commit the data to the LMS when the content is exited.  

Are you having a problem where the second attempt on content is overwriting the previously recorded score?  If not, can you clarify your issue?

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