Javascript prez.time not work in scorm resume session

Versione 9.1.2

as long as the scroll window remains open, prez.time returns the correct value. but if you close the “scorm” window and then reopen it prez.time always returns the value of 0.

but it work in html preview in activepresenter

How are you triggering this and displaying the value?

alert(‘Time:’+prez.slideTime());

	if (questionTimeRange[1]>=prez.time())

There should be some sort of an event that triggers the script.
Is the learner clicking a button which executes the JavaScript or is there an onLoad action to the slide…etc?

I notice you are making use of both time() and slideTime()

time() will provide the milliseconds based on where you are in the entire presentation whereas slideTime() will provide the milliseconds based on where you are in a given slide. That means the values may not match up.

Is there more to the code above? it seems incomplete.

Is the alert supposed to be the action that takes place when the if statement returns true?

its run in this function:
prez.myShowSection = function(atSectionStart) {
var sectionData = this.mySections[this.mySectionIndex];
if (!sectionData)
return;
if (atSectionStart)
this.slideTime(sectionData.startTime);
var questionTimeRange = sectionData.questionTime;
this.myRandomQuestionTime = randomNumber(questionTimeRange[0], questionTimeRange[1]);

alert(questionTimeRange[1]);
alert('sectiondata:'+sectionData.startTime);
alert('prez.time:'+prez.time());
alert('slideTime:'+prez.slideTime());



	if (questionTimeRange[1]>=prez.time()) 
	{
		alert('sectionIndex:'+prez.mySectionIndex);
		alert('entra nella if');
		this.myShowQuestionInTimer(sectionData.questions);
	}
	else
		 {
			alert('salta sezione');
			alert(sectionData.startTime);
			alert(prez.elapsedTime());
			alert('salta sezione prez.time:'+prez.time());
			prez.myShowNextSection();
		}

};

is this a couse with random silde in random range

note timeelapsed work in scorm
and prez.time work too until user close the window course (moodle paltform)
but if reopeon restart course windows the bar for example say 2 minutes but prez.tim is 0

I was working on trying to connect all the dots.

At the moment I see your function called myShowSection() but I do not see where that function is called.

My concern at this point is that in an LMS environment where the course is being resumed at a point somewhere in the middle - are we at a point beyond where something that needs to be called is being missed?

In other words - perhaps this works fine when starting from the beginning because all the dots are in place but does not work correctly when starting in the middle because critical functions are getting bypassed?

Could this be the issue…?

Unfortunately - I will be away from my computer now for a while and will not be available to help brainstorm this again until tomorrow.

1 Like

Hi,

The prez.time script is functioning correctly in our test, as demonstrated here:
https://activepresenter.online/mod/scorm/view.php?id=7176
If you suspect that your script may have an issue, please feel free to share your project with us. You can either attach it publicly here or send it privately to support@atomisystems.com for evaluation.

Regards,