MDL-43412 quiz with grade period and password did not work.

Once the attempt became overdue, it was impossible to get in to submit
it because of a redirect loop. This fix resovles that loop, so the
student can enter their password and get in.
This commit is contained in:
Tim Hunt 2014-01-08 17:55:25 +00:00
parent bbb291b7b7
commit 1f8ff396d2
2 changed files with 7 additions and 5 deletions

View File

@ -93,9 +93,7 @@ if ($lastattempt && ($lastattempt->state == quiz_attempt::IN_PROGRESS ||
$quizobj->create_attempt_object($lastattempt)->handle_if_time_expired($timenow, true);
// And, if the attempt is now no longer in progress, redirect to the appropriate place.
if ($lastattempt->state == quiz_attempt::OVERDUE) {
redirect($quizobj->summary_url($lastattempt->id));
} else if ($lastattempt->state != quiz_attempt::IN_PROGRESS) {
if ($lastattempt->state == quiz_attempt::ABANDONED || $lastattempt->state == quiz_attempt::FINISHED) {
redirect($quizobj->review_url($lastattempt->id));
}
@ -159,7 +157,11 @@ if ($accessmanager->is_preflight_check_required($currentattemptid)) {
$accessmanager->notify_preflight_check_passed($currentattemptid);
}
if ($currentattemptid) {
redirect($quizobj->attempt_url($currentattemptid, $page));
if ($lastattempt->state == quiz_attempt::OVERDUE) {
redirect($quizobj->summary_url($lastattempt->id));
} else {
redirect($quizobj->attempt_url($currentattemptid, $page));
}
}
// Delete any previous preview attempts belonging to this user.

View File

@ -64,7 +64,7 @@ if (!$attemptobj->is_preview_user() && $messages) {
$output->access_messages($messages));
}
if ($accessmanager->is_preflight_check_required($attemptobj->get_attemptid())) {
redirect($attemptobj->start_attempt_url(null, $page));
redirect($attemptobj->start_attempt_url(null));
}
$displayoptions = $attemptobj->get_display_options(false);