Index: lang/en_utf8/help/quiz/timedelay1.html
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/help/quiz/timedelay1.html,v
retrieving revision 1.3
diff -u -r1.3 timedelay1.html
--- lang/en_utf8/help/quiz/timedelay1.html 5 Jan 2007 06:40:34 -0000 1.3
+++ lang/en_utf8/help/quiz/timedelay1.html 28 Nov 2009 23:58:55 -0000
@@ -1,4 +1,9 @@
Time Delay between first and second attempt
If you set a time delay, then a student has to wait for that time before they can attempt a quiz after the first attempt.
-
+The time delay start counts from the last moment student could change his responses and get a grade, i.e.:
+
+- for a quiz without time limit - time of submission of the attempt;
+
- for a quiz with time limit - minimum of time of submission of the attempt and moment where time for an attempt run out.
+
+
Index: lang/en_utf8/help/quiz/timedelay2.html
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/help/quiz/timedelay2.html,v
retrieving revision 1.3
diff -u -r1.3 timedelay2.html
--- lang/en_utf8/help/quiz/timedelay2.html 5 Jan 2007 06:40:34 -0000 1.3
+++ lang/en_utf8/help/quiz/timedelay2.html 29 Nov 2009 00:00:18 -0000
@@ -1,4 +1,9 @@
Time Delay between additional quiz attempts
If you set a time delay here, then a student has to wait for that time before they can attempt their third or later attempts.
-
+The time delay start counts from the last moment student could change his responses and get a grade, i.e.:
+
+- for a quiz without time limit - time of submission of the attempt;
+
- for a quiz with time limit - minimum of time of submission of the attempt and moment where time for an attempt run out.
+
+
Index: mod/quiz/attempt.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/quiz/attempt.php,v
retrieving revision 1.131.2.17
diff -u -r1.131.2.17 attempt.php
--- mod/quiz/attempt.php 30 Sep 2009 10:58:03 -0000 1.131.2.17
+++ mod/quiz/attempt.php 28 Nov 2009 23:41:44 -0000
@@ -155,9 +155,12 @@
$numattempts = 0;
}
$timenow = time();
- $lastattempt_obj = get_record_select('quiz_attempts', "quiz = $quiz->id AND attempt = $numattempts AND userid = $USER->id", 'timefinish');
+ $lastattempt_obj = get_record_select('quiz_attempts', "quiz = $quiz->id AND attempt = $numattempts AND userid = $USER->id", 'timefinish, timestart');
if ($lastattempt_obj) {
$lastattempt = $lastattempt_obj->timefinish;
+ if ($quiz->timelimit > 0) {
+ $lastattempt = min($lastattempt, $lastattempt_obj->timestart + $quiz->timelimit*60);
+ }
}
if ($numattempts == 1 && !empty($quiz->delay1)) {
if ($timenow - $quiz->delay1 < $lastattempt) {
Index: mod/quiz/view.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/quiz/view.php,v
retrieving revision 1.124.2.19
diff -u -r1.124.2.19 view.php
--- mod/quiz/view.php 30 Sep 2009 10:58:04 -0000 1.124.2.19
+++ mod/quiz/view.php 28 Nov 2009 23:52:09 -0000
@@ -368,6 +368,9 @@
$tempunavailable = '';
$lastattempt = end($attempts);
$lastattempttime = $lastattempt->timefinish;
+ if ($quiz->timelimit > 0) {
+ $lastattempttime = min($lastattempttime, $lastattempt->timestart + $quiz->timelimit*60);
+ }
if ($numattempts == 1 && $quiz->delay1 && $timenow <= $lastattempttime + $quiz->delay1) {
$tempunavailable = get_string('temporaryblocked', 'quiz') .
' '. userdate($lastattempttime + $quiz->delay1). '';