Permalink
Browse files

MDL-34109 quiz cron: timelimit are timeclose of 0 are special.

If the timelimit or timeclose of a quiz are 0, this means 'no
restriction', rather than '1970' or '0 seconds'. We need to handle these
special cases correctly in the code that looks for quiz attempts that
might be in the wrong state.
  • Loading branch information...
1 parent 592443f commit 2b1b2017a648d3da571e0d6995e0b6cc7fcf04d2 @timhunt timhunt committed with danpoltawski Jun 29, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 mod/quiz/cronlib.php
View
@@ -127,15 +127,15 @@ protected function get_list_of_overdue_attempts($processfrom, $processto) {
WHERE (
state = 'inprogress' AND (
- :timenow1 > usertimeclose OR
- :timenow2 > quiza.timestart + usertimelimit
+ (usertimeclose > 0 AND :timenow1 > usertimeclose) OR
+ (usertimelimit > 0 AND :timenow2 > quiza.timestart + usertimelimit)
)
)
OR
(
state = 'overdue' AND (
- :timenow3 > graceperiod + usertimeclose OR
- :timenow4 > graceperiod + quiza.timestart + usertimelimit
+ (usertimeclose > 0 AND :timenow3 > graceperiod + usertimeclose) OR
+ (usertimelimit > 0 AND :timenow4 > graceperiod + quiza.timestart + usertimelimit)
)
)

0 comments on commit 2b1b201

Please sign in to comment.