Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

quiz reports MDL-21111 Quiz duration is reported in years if Time Fin…

…ish is before Time Start

Suppose you have two load-balanced servers with badly-synchronised clocks, and
a student does a really quick quiz attempt.

Then it is possible that quiz_attemtp.timestart is greater than quiz_attemtp.timefinish.
And these columns are unsigned (on MySQL) so timefinish - timestart is compulted as
a number close to 2^64, which is about 42 times the age of the universe.

Do the subtraction in PHP instead. (But we still need to compute a duration columnin PHP
because sometimes we sort on it.)
  • Loading branch information...
commit 348aae868089ed626eee204cd2e02ad58353710a 1 parent f7046b2
@timhunt timhunt authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  mod/quiz/report/overview/report.php
View
2  mod/quiz/report/overview/report.php
@@ -491,7 +491,7 @@ function display($quiz, $cm, $course) {
}
if ($attempt->timefinish) {
$timefinish = userdate($attempt->timefinish, $strtimeformat);
- $duration = format_time($attempt->duration);
+ $duration = format_time($attempt->timefinish - $attempt->timestart);
if (!$download) {
$row[] = '<a href="review.php?q='.$quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$timefinish.'</a>';
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.