]> git.mjollnir.org Git - moodle.git/commitdiff
question preview: MDL-17418 Enable previewing of random questions.
authortjhunt <tjhunt>
Thu, 8 Jan 2009 09:03:49 +0000 (09:03 +0000)
committertjhunt <tjhunt>
Thu, 8 Jan 2009 09:03:49 +0000 (09:03 +0000)
Also, fix a grade rounding issue.

question/preview.php
question/type/shortanswer/questiontype.php

index e1f48459f975ae1d37ab7136251be1e828b5d7ef..08005f4fc725f9a7b7a5dce88fc889e9a5349c37 100644 (file)
@@ -68,6 +68,7 @@
         $quiz->review = get_config('quiz', 'review');
         require_login($courseid, false);
         $quiz->course = $courseid;
+        $quiz->decimalpoints = get_config('quiz', 'decimalpoints');
         $context = get_context_instance(CONTEXT_COURSE, $courseid);
     } else if (!$quiz = $DB->get_record('quiz', array('id' => $quizid))) {
         print_error('invalidquizid', 'quiz', '', $quizid);
     $attempt->timemodified = $timenow;
     $attempt->uniqueid = 0;
     $attempt->id = 0;
+    $attempt->layout = $id;
 
     // Restore the history of question sessions from the moodle session or create
     // new sessions. Make $states a reference to the states array in the moodle
index c588cc107a8db31e003728420faba4a6c890d6f4..afc2d751dca5a1c001bdff2fd3ce39a0a5508bb0 100644 (file)
@@ -427,7 +427,7 @@ class question_shortanswer_qtype extends default_questiontype {
                         if ('' !== $state->last_graded->penalty && ((float)$state->last_graded->penalty) > 0.0) {
                             // A penalty was applied so display it
                             echo ' ';
-                            print_string('gradingdetailspenalty', 'quiz', $state->last_graded->penalty);
+                            print_string('gradingdetailspenalty', 'quiz', question_format_grade($cmoptions, $state->last_graded->penalty));
                         } else {
                             /* No penalty was applied even though the answer was
                             not correct (eg. a syntax error) so tell the student