What happens if a session times out in the middle of a quiz?

What happens if a session times out in the middle of a quiz?

بواسطة - N Hansen
عدد الردود: 7
If a student is in the middle of doing a quiz, and their session times out while they are doing it, when they go to submit the page, and are redirected to login again, will their work be lost or will it be submitted once they login again?
متوسط التقييمات: -
رداً على N Hansen

Re: What happens if a session times out in the middle of a quiz?

بواسطة - Gustav W Delius
Their work will be lost unless they have saved it. Therefore please advise your students to save their results frequently while they are taken the quiz (this also protects them against browser crashes and other such accidents). Any responses that they have already saved, marked or not, will not be lost. If you have a longer quiz it may also help to split it over several pages because each time a student navigates to another page their responses will automatically be saved.
رداً على Gustav W Delius

Re: What happens if a session times out in the middle of a quiz?

بواسطة - Roman Weinberger
imo this would be a nice example where AJAX could be very beneficial - storing each answer as soon as it was given (onblur event or the like) in a temporary table

as i am not too familiar with moodles question type architekture - would this mean to replace every question type with its own version or just some standard controls library?
رداً على Roman Weinberger

AJAX for quiz module

بواسطة - Gustav W Delius
AJAX would indeed be very useful for this purpose. You would only need to change mod/quiz/attempt.php so that when saving results it does not submit the form via POST but using AJAX instead. Unfortunately I don't know any AJAX myself (I don't even know javascript properly).
رداً على Gustav W Delius

Re: AJAX for quiz module

بواسطة - Roman Weinberger
so in attempt.php i can modify all input etc. tags in order to add ajax callbacks?
رداً على Roman Weinberger

Re: AJAX for quiz module

بواسطة - Gustav W Delius
Ah, no, to get at those you would indeed have to modify the question types. But that will be the easy bit that can be done quickly later. The first step would be to make the "Save" button use AJAX. 
رداً على Gustav W Delius

Re: AJAX for quiz module

بواسطة - Roman Weinberger
thank you for the information so far

my first priority would be, not to use ajax to store quiz answers, but to somehow keep the session alive - like when a user clicks some form element, an ajax request is sent to the server saying 'the user is working - keep his session alive' - this should be easier to implement than ajaxify attempt.php مبتسم

i will try to implement this idea in the next few days and post my results