]> git.mjollnir.org Git - moodle.git/commitdiff
Better error checking when trying to show an incomplete attempt
authormoodler <moodler>
Wed, 18 Feb 2004 08:40:58 +0000 (08:40 +0000)
committermoodler <moodler>
Wed, 18 Feb 2004 08:40:58 +0000 (08:40 +0000)
lang/en/quiz.php
mod/quiz/review.php

index dc2eacf369ea73db3563ea2a5183d5006eb53018..800d60245a1e875248f87ff5eb144d0ce9346356 100644 (file)
@@ -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';
index 2f7a7628b366389a9fdae54652a303479a0b88bc..bcc0f0ebb828583e6d4360267aa601328217e061 100644 (file)
 
 
     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);