quiz - with session keep alive

quiz - with session keep alive

ໂດຍ Colin G -
ຈຳນວນການຕອບກັບ: 2

I was doing a 2 hour quiz recently in full screen the pop-up mode and my session timed out. When I clicked the next button after spending a very long time typing text and completing the task on the page I was left with only some debug info on the screen. This was a v2.6.1 so no autosave and I lost everything I had typed. Not good !!!!


This is hack will let you run a quiz with very long tasks while maintaining a short session time out. While the quiz attempt pages are open it keeps the users session alive - forever. Once the quiz has ended the session will timeout as normal.

This is for quiz mod v2.8.1 but easy to get working on older versions.

Copy the attached files to mod/quiz, flush your cache and the go to :

Site administration -> Activity modules -> Quiz -> quiz | keepalive

To activate session keep alive tick the box and save. You will see a security warning at the top of your quiz. Also a good idea to make sure autosave is turned on. The keep-alive is set for 4 mins so even the shortest 5min session timeout should not timeout. If anyone shows interest I may add a select box so the user can set the ping time. Longer is better.



ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Colin G

Re: quiz - with session keep alive

ໂດຍ Tim Hunt -
ຮູບພາບຂອງ Core developers ຮູບພາບຂອງ Documentation writers ຮູບພາບຂອງ Particularly helpful Moodlers ຮູບພາບຂອງ Peer reviewers ຮູບພາບຂອງ Plugin developers

Just a warning to people who might use this: When the install instructions say "Copy the attached files to mod/quiz" - this will overwrite some of the standard Moodle files, which will cause problems the next time you try to upgrade.

Colin, I think you could implement your change as a self-contained plugin, if you wanted to make it easier or safer for people to use: https://docs.moodle.org/dev/Quiz_access_rules.

However, just turning on autosave is almost as good as this change for keeping the session alive, and it also autosaves.

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Tim Hunt

Re: quiz - with session keep alive

ໂດຍ Colin G -
Yes the quiz I was doing was moodle 2.6 so there was no autosave. When my session timed out I was just left with a popup screen with debug info. The debug screen in a popup will be very confusing for many users.

If you turn autosave on does it keep the users session alive if they do not type anything ?
ການຈັດອັນດັບສະເລ່ຍ: -