updated 2018-06-26
Unreliable grade tracking in lesson module
moodle has known for years that their grades (course >> grades) are unreliable and that their calculations of “time spent in a lesson” are wrong, but have still, as of now, (moodle 2.1.2, October 10th, 2011) not done anything about it.
2017-2018: in moodle 3.3 the lesson module has been greatly enhanced.
Much that has been written below is finally history!
Lesson Grades and Time Spent are incorrect when
1. a person starts a lesson and then returns later to complete it, or
2. a person refreshes-re-displays the first page of the lesson.
when re-entering a lesson, the lesson timer updates the old record, giving you credit for the time you were out, instead of writing a new record. In another case, I went into the first page of a lesson for only a few seconds and left. Days later, I went back in and completed the lesson. I then went in as admin to the course, clicked on “Grades” and looked at the scores for that lesson only do discover that my score (100%) was assigned to the 5 second session many days ago, not the 6 minutes session, today, when I did the work. That 6 min. record, when I did the work, does not show up at all (course >> grades). Actually, both records are there, this “grades” program reads the first one to get the date and the last one to get the grade. Talk about screwed up.
If you refresh the first page, your time spent gets wiped out and the start-time is reset to the current moment.
If you enter a lesson for the first time, and then exit so that the lesson-timer record does not get updated, in the course >> grades display, it might (?) say the date and time and “(now)”, but that date and time is NOT “now”, it is past already. Again, the report program is screwed up.
Re-entering an un-timed lesson, mod/lesson/view.php asks “Do you want to start on the last page you saw?” It knew you had been out and returned but, after clicking ‘yes’ (or ‘no’) it updates the old lesson_timer record including all the time you have been gone. It did not start a new lesson_timer record, as it should have. Worse, moodle consistently looses all but the most recent time-stamp record. I go back into any lesson I have already completed and it says “attempt 1”.
Re-entering a timed lesson, it says “Required time in lesson not met. Click continue to restart.” Again, it knew you had been out and returned but, after clicking ‘continue’ it also updates the old lesson_timer record to include all the time you have been gone – instead of starting a new record, as it should have.
When I had only entered the first page of a lesson, previously, and left, it did not ask “Do you want to …” (which makes sense) and it did, correctly, write a new lesson_timer record*. When I entered one time from a course index page, it started a new record properly*.
Solution, write the new record before asking the question. Find the code, and move it up, before the question. Remove the condition which keeps it from working after after page 1.
Solution: in mod/lesson/view.php moodle 2.1.x (& mdl 2.0.x)
This code, starting on line 260, needs to be moved up, and put under line 182.
182 add_to_log($course->id, 'lesson', 'start', 'view.php?id='. . . .
/// This is the code for starting a timed test if(!isset($USER->startlesson[$lesson->id]) && !$canmanage) { $lesson->start_timer(); }
and, change the if statement to ONLY check for “canmanage”:
if(!$canmanage) {
Solution: in mod/lesson/view.php moodle 1.9.x
189 add_to_log($course->id, 'lesson', 'start', 'view.php?id='. . . .
This, below, block of code starts on line 314 and was moved to, line 190, inserted under, line 189 (“add_to_log”):
###begin### this code move up from (about 140 lines) below ### gks 4-15-2009 ####################### # This is not the code for starting a timed test # This is the code for writing or updating a mdl_lesson_timer (log) record, # when starting or restarting a lesson 314 /// This is the code for starting a timed test -- line 316 in ver. 1.9.9 # if(!isset($USER->startlesson[$lesson->id]) && !has_capability('mod/lesson:manage', $context)) { # old if(!has_capability('mod/lesson:manage', $context)) { # new $USER->startlesson[$lesson->id] = true; $startlesson = new stdClass; $startlesson->lessonid = $lesson->id; $startlesson->userid = $USER->id; $startlesson->starttime = time(); $startlesson->lessontime = time(); if (!insert_record('lesson_timer', $startlesson)) { error('Error: could not insert row into lesson_timer table'); } if ($lesson->timed) { lesson_set_message(get_string('maxtimewarning', 'lesson', $lesson->maxtime), 'center'); } 330 }
This, above, block of code starts on line 314 and was moved to, line 190, inserted under, line 189 (“add_to_log”):
A few years ago, I made several corrections to this lesson code – and still have to apply it to every new release! Related to the time spent, is the issue of the 2 lesson timers. The minimum timer is not logical either. You leave a lesson and return to find you have to spend the full time all over again. No credit for “time spent” I also fixed that.
Whoever wrote the lesson module, years ago, mangled it up so badly that today, no one wants to deal with it. Moodle is now (as of ver.2.0) asking for money to pay to have it fixed: (that didn’t go over very well)
Moodle 2.0
As stated in our Roadmap, funding is required if lesson module improvements are to be included in Moodle 2.0.
If your organisation is able to offer funding, please submit a ticket at the Moodle.com helpdesk.
If funding is not received in time, as Martin mentioned in the September developer meeting, Moodle HQ will most likely step in and do some emergency work to get the lesson module working in Moodle 2.0.
copied on 2011-01-12 from
http://docs.moodle.org/en/Lesson_module_FAQ#What_does_the_future_hold_for_the_lesson_module_in_Moodle_2.0.3F
end result: moodle headquarters finally fixed it in ver. 3.3
Thanks! This and your subsequent post on Moodle time tracking really helped make the time spent dependency more accurate.