Index: lang/en_utf8/help/quiz/timedelay1.html =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/help/quiz/timedelay1.html,v retrieving revision 1.4 diff -u -r1.4 timedelay1.html --- lang/en_utf8/help/quiz/timedelay1.html 10 Mar 2009 08:42:54 -0000 1.4 +++ lang/en_utf8/help/quiz/timedelay1.html 29 Nov 2009 19:25:42 -0000 @@ -2,4 +2,10 @@

If you set a time delay, then the student has to wait for that amount of time to pass after the end of their first attempt before they can start their second attempt.

+

The end of first attempt is the last moment student could change his responses and get a grade, i.e.: +

+

Index: lang/en_utf8/help/quiz/timedelay2.html =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/help/quiz/timedelay2.html,v retrieving revision 1.4 diff -u -r1.4 timedelay2.html --- lang/en_utf8/help/quiz/timedelay2.html 10 Mar 2009 08:42:54 -0000 1.4 +++ lang/en_utf8/help/quiz/timedelay2.html 29 Nov 2009 19:25:47 -0000 @@ -2,4 +2,9 @@

If you set a time delay, then the student has to wait for that amount of time to pass after the end of their previous attempt before they can start their third or later attempt.

- +

The end of first attempt is the last moment student could change his responses and get a grade, i.e.: +

+

Index: mod/quiz/accessrules.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/accessrules.php,v retrieving revision 1.32 diff -u -r1.32 accessrules.php --- mod/quiz/accessrules.php 4 Nov 2009 11:58:31 -0000 1.32 +++ mod/quiz/accessrules.php 29 Nov 2009 20:07:47 -0000 @@ -544,11 +544,19 @@ /// No more attempts allowed anyway. return false; } + if (!is_object($lastattempt)) { + /// This is the first attempt. + return false; + } + $lastattemptfinish = $lastattempt->timefinish; + if ($this->_quiz->timelimit > 0){ + $lastattemptfinish = min($lastattemptfinish, $lastattempt->timestart + $this->_quiz->timelimit); + } $nextstarttime = 0; if ($numprevattempts == 1 && $this->_quiz->delay1) { - $nextstarttime = $lastattempt->timefinish + $this->_quiz->delay1; + $nextstarttime = $lastattemptfinish + $this->_quiz->delay1; } else if ($numprevattempts > 1 && $this->_quiz->delay2) { - $nextstarttime = $lastattempt->timefinish + $this->_quiz->delay2; + $nextstarttime = $lastattemptfinish + $this->_quiz->delay2; } if ($this->_timenow < $nextstarttime) { if ($this->_quiz->timeclose == 0 || $nextstarttime <= $this->_quiz->timeclose) {