From dbb491925846c8e530a30df479afd78ffe9d0a9e Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 18 Feb 2004 08:40:58 +0000 Subject: [PATCH] Better error checking when trying to show an incomplete attempt --- lang/en/quiz.php | 1 + mod/quiz/review.php | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/en/quiz.php b/lang/en/quiz.php index dc2eacf369..800d60245a 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -24,6 +24,7 @@ $string['attemptlast'] = 'Last attempt'; $string['attemptquiznow'] = 'Attempt quiz now'; $string['attempts'] = 'Attempts'; $string['attemptsallowed'] = 'Attempts allowed'; +$string['attemptincomplete'] = 'That attempt (by $a) is not yet completed.'; $string['attemptsunlimited'] = 'Unlimited attempts'; $string['backtoquiz'] = 'Back to quiz editing'; $string['bestgrade'] = 'Best grade'; diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 2f7a7628b3..bcc0f0ebb8 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -84,7 +84,14 @@ if (! $questions = quiz_get_attempt_responses($attempt)) { - error("Could not reconstruct quiz results for attempt $attempt->id!"); + if ($user = get_record("user", "id", $attempt->userid)) { + $fullname = fullname($user); + } else { + $fullname = "????"; + } + print_heading(get_string("attemptincomplete", "quiz", $fullname)); + print_footer($course); + exit; } quiz_remove_unwanted_questions($questions, $quiz); -- 2.39.5