Measuring "Time spent" in Lesson

Measuring "Time spent" in Lesson

by Joseph Rézeau -
Number of replies: 16
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Further to these discussions Prerequisite Lesson vs Conditional activities and the second question asked by Wendi in that other discussion: Timer.

1.- Like the Quiz activity, the Lesson activity features a timer. This is used to limit the time spent in a Lesson to a certain number of minutes. The Lesson timer is not as sophisticated as the Quiz timer, as it will only refresh upon student submit action.

2.- In a Lesson's prerequisite features, a lesson (B) can be set to be made available to a student only spent a required number of minutes in another lesson (A). However, there is nothing to tell a student how much time they have spent in a lesson so far (while taking the lesson) nor how much time they have spent in a lesson (when they have reached the end of the lesson). In order to avoid confusion with the original Timer feature, I suggest this would called "Stop watch" or "Chronometer".

I agree with Wendi's suggestion that such a feature would be useful in this case. This might be a similar "widget" to the so-called "Progress bar". Each time a student has submitted an answer/changed pages, a message could be displayed along these lines:

"You have already spent xx minutes in this lesson (A). You need to spend a minimum of yy minutes here in order to access Lesson B."

A more sophisticated feature might even display a progress bar showing the target time and time spent, similar to the progress bar.

Joseph

Average of ratings: -
In reply to Joseph Rézeau

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -
So, I take it that nothing like this has been developed yet?
In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

There is a "timer" of a sort in the Moodle ftp files...


public_html/yourdomainname/mod/lesson/timer.js


Does anyone know what this does, or how to get it to do what we are wanting it to do? The notes in the file say that it originally had a clock, and then it was modified to be a countdown timer. Is there a way to modify this code and bring back the clock, make it a "count up" timer that is in synch with the prerequisite command of time spent in lesson A before being allowed access to lesson B?

In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

I'll have a look at that timer.js script. It seems to be very old.

Joseph

In reply to Joseph Rézeau

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -
Thank you for looking into that, Joseph. I would hope the age of it does not mean it cannot be used. I already emailed the latest author, as he put his email in the script. Will keep you posted as I find things out.
In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Jean-Michel Védrine -

Hello Wendi,

timer.js is just to display the time left in the lesson block. It has nothing to do with what you want.

In reply to Joseph Rézeau

Re: Measuring "Time spent" in Lesson

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Just found some related discussions:

in the General developer forum: https://moodle.org/mod/forum/discuss.php?d=183211

in the Lesson forum: https://moodle.org/mod/forum/discuss.php?d=148152

And also in the bug tracker: MDL-22105 where I have added a patch.

Joseph

In reply to Joseph Rézeau

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

Joseph, I just hacked in both this code and the time remaining code in the link. They both work great! Thank you so very much for all of your hard work and help!

In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

Joseph, I found that the script I entered causes a problem with the questions at the end of the lesson. The user answers the last question of the lesson and gets this message:

Undefined variable: duration in /home/(my ID)/public_html/(my site)/mod/lesson/view.php on line 111


That is the line with the added code 

$duration = +$attempttime->lessontime - $attempttime->starttime;


Do you know how we can fix this so the system accounts for questions at the end of the lessons?

In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

Whoops, I misreported the code here. I had it as it is supposed to be, and it was apparently not the problem as I removed it and the problem continued. Disregard last entry.



In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

I was wrong, the problem is still there. This is the error message I get at the end of the questions at the end of the lesson:

***************************************************

Notice: Undefined variable: duration in /home/(ny id)/public_html/(my domain)/mod/lesson/view.php on line 111 This page should automatically redirect. If nothing is happening please use the continue link below.

This page should automatically redirect. If nothing is happening please use the continue link below.

Error output, so disabling automatic redirect.

***********************************************************

Any ideas?


In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

Joseph, do you know how to fix this?

In reply to Wendi Daniels

Re: Measuring "Time spent" in Lesson

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Joseph is retired, Wendi, and  a few months back he  announced that he was going to stop working on Moodle and work more in his flower garden, so you may not get a reply.

In reply to Mary Cooch

Re: Measuring "Time spent" in Lesson

by Wendi Daniels -

Alright, but I hope someone can fix this...my students are raising their eyebrows at it, as it looks problematic.