mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
question preview: MDL-17418 Enable previewing of random questions.
Also, fix a grade rounding issue.
This commit is contained in:
parent
7d10995c86
commit
71990c7cf6
2 changed files with 3 additions and 1 deletions
|
@ -68,6 +68,7 @@
|
||||||
$quiz->review = get_config('quiz', 'review');
|
$quiz->review = get_config('quiz', 'review');
|
||||||
require_login($courseid, false);
|
require_login($courseid, false);
|
||||||
$quiz->course = $courseid;
|
$quiz->course = $courseid;
|
||||||
|
$quiz->decimalpoints = get_config('quiz', 'decimalpoints');
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||||
} else if (!$quiz = $DB->get_record('quiz', array('id' => $quizid))) {
|
} else if (!$quiz = $DB->get_record('quiz', array('id' => $quizid))) {
|
||||||
print_error('invalidquizid', 'quiz', '', $quizid);
|
print_error('invalidquizid', 'quiz', '', $quizid);
|
||||||
|
@ -115,6 +116,7 @@
|
||||||
$attempt->timemodified = $timenow;
|
$attempt->timemodified = $timenow;
|
||||||
$attempt->uniqueid = 0;
|
$attempt->uniqueid = 0;
|
||||||
$attempt->id = 0;
|
$attempt->id = 0;
|
||||||
|
$attempt->layout = $id;
|
||||||
|
|
||||||
// Restore the history of question sessions from the moodle session or create
|
// 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
|
// new sessions. Make $states a reference to the states array in the moodle
|
||||||
|
|
|
@ -427,7 +427,7 @@ class question_shortanswer_qtype extends default_questiontype {
|
||||||
if ('' !== $state->last_graded->penalty && ((float)$state->last_graded->penalty) > 0.0) {
|
if ('' !== $state->last_graded->penalty && ((float)$state->last_graded->penalty) > 0.0) {
|
||||||
// A penalty was applied so display it
|
// A penalty was applied so display it
|
||||||
echo ' ';
|
echo ' ';
|
||||||
print_string('gradingdetailspenalty', 'quiz', $state->last_graded->penalty);
|
print_string('gradingdetailspenalty', 'quiz', question_format_grade($cmoptions, $state->last_graded->penalty));
|
||||||
} else {
|
} else {
|
||||||
/* No penalty was applied even though the answer was
|
/* No penalty was applied even though the answer was
|
||||||
not correct (eg. a syntax error) so tell the student
|
not correct (eg. a syntax error) so tell the student
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue