Unreliable time tracking in lesson module

Unreliable time tracking in lesson module

by Tomasz Muras -
Number of replies: 5
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Hi there,

I wanted to run it here before reporting in the bug in tracker. I'm looking at the 2 related problems with the lesson module in Moodle 1.9.

1. Sometimes it happens that report page mod/lesson/report.php?id=NNN is showing entries with 0 timestamp, that is: "Thursday, 1 January 1970, 12:00 AM, (now)".
2. In other cases a date shown on the report page mod/lesson/report.php?id=NNN is a different date then when you follow the link to detailed report on mod/lesson/report.php?id=NNN&action=reportdetail&userid=NNN&try=NNN.

The first issue happens when there are not enough entries in lesson_timer table, e.g. if there are 10 tries but only 7 records in lesson_timer.

The direct reason for the second issue was reverse - there was 1 try recorded but 3 entries in lesson_timer. First report page took the first entry from lesson_timer but second report grabbed the last one.

I assume that this happens because of some weird error condition (broken connectivity, stopped, script, etc). It's also caused by lack of transactions in the code.

But the biggest (and probably easiest to fix) issue here is that entries in lesson_timer do not use any foreign ID to refer to the relevant try in other tables. The code simply takes the tries, takes the entries from lesson_timer and matches them "manually" (first try == first row from lesson_timer). This is working very unreliably, to my surprise I couldn't find any issues related to it and logged in the tracker.

Would you have any thoughts on this? I see that the lesson_timer table is the same in latest Moodle 2.2dev, are there any plans by HQ to work on lesson mod?

Tomasz (Tomek) Muras
Enovation Solutions

Average of ratings: -
In reply to Tomasz Muras

Re: Unreliable time tracking in lesson module

by Rossiani Wijaya -

Hi Tomasz,

Thanks for reporting this.

Which version of 1.9 are you using?  

I tested on 1.9.14, it seems to work fine.

Could you provide some test instruction to re-produce the issue?

In reply to Rossiani Wijaya

Re: Unreliable time tracking in lesson module

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Hi Rossiani,

I can not reproduce it - I suspect it's happening due to some unusal error condition (broken connectivity, refreshing the page before lesson loads, some race  condition). I can see the end effect - incomplete records in the database. This is happening for different students using different IPs, so I assume it's not related to just their environment.

What I'm proposing here is to increase the reliability - e.g. add the foreign keys to the tables. What do you think?

Tomasz (Tomek) Muras

In reply to Tomasz Muras

Re: Unreliable time tracking in lesson module

by Domi Sinclair -

Hello Tomasz,

We have been having similar problems to yours, and this is the only record of it I can find.

Glad to find out it's not just us!

I was just wondering if you ever found a solution?

If anyone else knows of anything related to this issue I'd appreciate any help!

Best wishes, 

Domi Sinclair

In reply to Domi Sinclair

Re: Unreliable time tracking in lesson module

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Hi Domi,

I don't have any more information about the issue I'm afraid. I suspect this is not fixed - it would require re-writing logic in lesson module, to make the code more reliable and robust.

Are you able to reproduce the problem? Eg follow steps A,B,C... and end up with invalid records?

Tomek

In reply to Tomasz Muras

Re: Unreliable time tracking in lesson module

by Domi Sinclair -

As with you it's not really a problem that can be easily replicated by following certain steps. Sometime sit works just fine and other it does not.