How do you switch off the memory for the last lesson page you visited? - don't want to see "You have seen more than one page of this lesson already." any more

How do you switch off the memory for the last lesson page you visited? - don't want to see "You have seen more than one page of this lesson already." any more

by Sacha Brostoff -
Number of replies: 5
Hello,

We'd like to switch off the feature that remembers the last page you visited in a lesson, so we can avoid getting the message,

"You have seen more than one page of this lesson already.
Do you want to start at the last page you saw?"

... more specifically, what we want to avoid is the deletion of records from mdl_lesson_attempts that occurs when people see the above message and answer "No".

Actually, even more specifically than that, we want to have a permanent record of the first attempt that's made on each lesson page with a question on it.

Does anyone have any ideas?

With many thanks,

Sacha
Average of ratings: -
In reply to Sacha Brostoff

Re: How do you switch off the memory for the last lesson page you visited? -

by Sandra King -
I am not sure which version of Moodle you are using. We are using Moodle1.8.2+
All of our students attempts are recorded for teacher viewing.

Teachers can click on the Reports tab at the top of the edit lesson screen and see a list of all attempts by every student...

For example:

Davis, Denise Collier 80% Friday, April 13, 2007, 03:09 PM, (30 mins 8 secs)
77.78% Friday, April 13, 2007, 04:06 PM, (8 mins 48 secs)
77.78% Friday, April 13, 2007, 04:16 PM, (4 mins 38 secs)
80% Friday, April 13, 2007, 04:22 PM, (7 mins 1 sec)
100% Friday, April 13, 2007, 04:29 PM, (2 mins 50 secs)
100%

or

Collier, Kimberly 87.5% Wednesday, December 26, 2007, 05:09 PM, (20 mins 41 secs)
100% Wednesday, December 26, 2007, 06:09 PM, (7 mins 16 secs)
87.5% Monday, December 31, 2007, 12:33 PM, (11 mins 56 secs)
100%


It is possible for teachers to delete attempts (but we have never had reason to do so).

If you click on the 'Update this Lesson' button these are the settings we use.
Attachment settings.gif
In reply to Sandra King

Re: How do you switch off the memory for the last lesson page you visited? -

by Sacha Brostoff -
Sandra, Hi!

Thanks for your clear explanation and really helpful screenshots! We're using 1.9, but the same problem occured on 1.8.2 before we upgraded.

It's funny - I never saw that Reports page before, even though it was right there in front of my face! That looks like a great feature.

This problem occurs before people get to the "End of Lesson" page. They may be half way through a lesson, then leave the lesson. The report page for the lesson looks like the top image in the attached gif. It lists an attempt that is "Not finished".

If the user then comes back to the lesson, she'll get the "You have seen more than one page of this lesson before. Do you want to start at the last page you saw?" message, and be given the Yes/No choice. If she clicks "No", then she will be taken to the first page of the lesson. The report page for the lesson now looks like the middle image in the attached gif.

It's like the student has deleted the record of her system use - not the teacher. So, she could have answered a question (or even most of the questions in the lesson) incorrectly - then erase her not finished attempt and start again from new. The teachers would have no idea, and they are adamant that they want to know what the students' first answers are.

A less malign scenario is that she could leave a lesson part way through because of some interruption (say, the latest episode of Battlestar Galactica!), then come back to it at a later point intending to finish the lesson, but wanting to refresh her memory before she continued with the question pages she hadn't yet attempted. She'd click "No" so she could see the earlier pages in the lesson, then through no fault of her own, all her answers to that lesson so far would be deleted. It's not clear in the user interface that records will be deleted if she clicks "No", and after she has clicked "No" it's not clear that records were deleted.

It would be good if this scenario could be avoided.

The settings for this lesson are in the bottom image in the gif. This same behaviour seems to occur if "Student can re-take" is set to Yes or to No.

Thanks again for your help!

Sacha
Attachment reports.gif
In reply to Sacha Brostoff

Re: How do you switch off the memory for the last lesson page you visited? -

by Sandra King -
I would probably leave the code that asks the question in place and remove the option to start back at the beginning.

I obviously haven't tried this in 1.9, but you might try commenting out a couple of lines of code in mod/lesson/view.php

In my 1.8 the code that controls the button appears around line 267 and looks like this...


} else {
print_simple_box("<p style=\"text-align:center;\">".get_string('youhaveseen','lesson').'</p>',
"center");

echo '<div style="text-align:center;">';
echo '<span class="lessonbutton standardbutton">'.
'<a href="view.php?id='.$cm->id.'&amp;pageid='.$lastpageseen.'&amp;startlastseen=yes">'.
get_string('yes').'</a></span>&nbsp;&nbsp;&nbsp;';
echo '<span class="lessonbutton standardbutton">'.
'<a href="view.php?id='.$cm->id.'&amp;pageid='.$firstpageid.'&amp;startlastseen=no">'.
get_string('no').'</a></div>';
echo '</span>';
}
print_footer($course);
exit();
}


The code that you probably want to comment out is
echo '<span class="lessonbutton standardbutton">'.
'<a href="view.php?id='.$cm->id.'&amp;pageid='.$firstpageid.'&amp;startlastseen=no">'.
get_string('no').'</a></div>';

This would stop that button from appearing and remove the option to return to the beginning of the lesson. Alternatively you could track down the string ('no') and modify what happens in the database.

Remember that if you (or your staff) comment out lines you should document the change you made (for your own records) that way as you go through future upgrades you can redo the change.
In reply to Sandra King

Re: How do you switch off the memory for the last lesson page you visited? -

by Sacha Brostoff -
Sandra, Hi!

That is totally awesome - THANKS!

Stupidly I never thought to look at the code myself - duh!

Your hack DEFINATELY works. That's amazingly cool!

It's such a relief to have a way round this - you are a MOODLE ROCK STAR!

You even inspired me to try to take things further.

I noticed that a difference between the code for the two buttons was in the value given to

startlastseen

In the Yes button, startlastseen=yes

In the No button, startlastseen=no

Can you think or, or do you know a good reason why I shouldn't make startlastseen=yes for both of the buttons?

There is code further down view.php which says what to do if $startlastseen=='no' or $startlastseen=='yes'

I can't read php for love nor money - and when I peer mystified at the code, it looks to me like when $startlastseen=='yes', view.php tries to reset a lesson timer. Or something. This doesn't sound too bad, since we are not using timed lessons and have no plans to.

And that when startlastseen=='no', there's some deletion type stuff. Or something. We don't like deletion of stuff - that's what we're trying to avoid.

What do you think? Is it risky and dangerous?

Thanks again for your wonderful help!

Sacha
In reply to Sacha Brostoff

Re: How do you switch off the memory for the last lesson page you visited? -

by Sandra King -
The risk is that it won't work the way you want it to. IF for some reason it broke the page, you should know immediately and be able to switch it back

( I always save the original version of the page - then make my changes and attempt the page I modified immediately after the change is made)

If you are changing code that effects the database, and are able to watch what is happening in there I would recommend it, otherwise immediately after testing your change I would check my student results again. Make sure there are no surprises.

Good luck.

PS. I can't read much PHP but I keep looking things up, whenever there is something I need to be able to do, eventually with all of the online help manuals I figure it out - especially with all of the helpful people here on Moodle.org.


Sandra King