diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index e8594d1547d..039bfc61d9a 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -146,7 +146,6 @@ class qtype_multianswer extends question_type { question_bank::get_qtype($wrapped->qtype)->get_question_options($wrapped); // For wrapped questions the maxgrade is always equal to the defaultmark, // there is no entry in the question_instances table for them. - $wrapped->maxmark = $wrapped->defaultmark; $wrapped->category = $question->categoryobject->id; $question->options->questions[$sequence[$wrapped->id]] = $wrapped; } @@ -303,7 +302,7 @@ class qtype_multianswer extends question_type { } } $question->subquestions[$key] = question_bank::make_question($subqdata); - $question->subquestions[$key]->maxmark = $subqdata->defaultmark; + $question->subquestions[$key]->defaultmark = $subqdata->defaultmark; if (isset($subqdata->options->layout)) { $question->subquestions[$key]->layout = $subqdata->options->layout; } diff --git a/question/type/multianswer/renderer.php b/question/type/multianswer/renderer.php index 528e7aacda4..8cb7b93c1f2 100644 --- a/question/type/multianswer/renderer.php +++ b/question/type/multianswer/renderer.php @@ -183,11 +183,11 @@ abstract class qtype_multianswer_subq_renderer_base extends qtype_renderer { } $subfraction = ''; - if ($options->marks >= question_display_options::MARK_AND_MAX && $subq->maxmark > 0 + if ($options->marks >= question_display_options::MARK_AND_MAX && $subq->defaultmark > 0 && (!is_null($fraction) || $feedback)) { $a = new stdClass(); - $a->mark = format_float($fraction * $subq->maxmark, $options->markdp); - $a->max = format_float($subq->maxmark, $options->markdp); + $a->mark = format_float($fraction * $subq->defaultmark, $options->markdp); + $a->max = format_float($subq->defaultmark, $options->markdp); $feedback[] = get_string('markoutofmax', 'question', $a); } @@ -483,10 +483,10 @@ class qtype_multianswer_multichoice_vertical_renderer extends qtype_multianswer_ $feedback = array(); if ($options->feedback && $options->marks >= question_display_options::MARK_AND_MAX && - $subq->maxmark > 0) { + $subq->defaultmark > 0) { $a = new stdClass(); - $a->mark = format_float($fraction * $subq->maxmark, $options->markdp); - $a->max = format_float($subq->maxmark, $options->markdp); + $a->mark = format_float($fraction * $subq->defaultmark, $options->markdp); + $a->max = format_float($subq->defaultmark, $options->markdp); $feedback[] = html_writer::tag('div', get_string('markoutofmax', 'question', $a)); } @@ -675,10 +675,10 @@ class qtype_multianswer_multiresponse_vertical_renderer extends qtype_multianswe $feedback = array(); if ($options->feedback && $options->marks >= question_display_options::MARK_AND_MAX && - $subq->maxmark > 0) { + $subq->defaultmark > 0) { $a = new stdClass(); - $a->mark = format_float($fraction * $subq->maxmark, $options->markdp); - $a->max = format_float($subq->maxmark, $options->markdp); + $a->mark = format_float($fraction * $subq->defaultmark, $options->markdp); + $a->max = format_float($subq->defaultmark, $options->markdp); $feedback[] = html_writer::tag('div', get_string('markoutofmax', 'question', $a)); } diff --git a/question/type/multianswer/tests/helper.php b/question/type/multianswer/tests/helper.php index 27ab5d6e301..c3f6ba80503 100644 --- a/question/type/multianswer/tests/helper.php +++ b/question/type/multianswer/tests/helper.php @@ -78,7 +78,7 @@ class qtype_multianswer_test_helper extends question_test_helper { 15 => new question_answer(15, '*', 0.0, 'Wrong answer', FORMAT_HTML), ); $sa->qtype = question_bank::get_qtype('shortanswer'); - $sa->maxmark = 1; + $sa->defaultmark = 1; // Multiple-choice subquestion. question_bank::load_question_definition_classes('multichoice'); @@ -104,7 +104,7 @@ class qtype_multianswer_test_helper extends question_test_helper { 'Well done!', FORMAT_HTML), ); $mc->qtype = question_bank::get_qtype('multichoice'); - $mc->maxmark = 1; + $mc->defaultmark = 1; $q->subquestions = array( 1 => $sa, @@ -342,7 +342,7 @@ class qtype_multianswer_test_helper extends question_test_helper { $data['Arizona'], FORMAT_HTML), ); $mc->qtype = question_bank::get_qtype('multichoice'); - $mc->maxmark = 1; + $mc->defaultmark = 1; $q->subquestions[$i] = $mc; } @@ -385,7 +385,7 @@ class qtype_multianswer_test_helper extends question_test_helper { ); $sub->qtype = question_bank::get_qtype('numerical'); $sub->ap = new qtype_numerical_answer_processor(array()); - $sub->maxmark = 1; + $sub->defaultmark = 1; $q->subquestions = array( 1 => $sub, @@ -444,7 +444,7 @@ class qtype_multianswer_test_helper extends question_test_helper { '', FORMAT_HTML), ); $mc->qtype = question_bank::get_qtype('multichoice'); - $mc->maxmark = 1; + $mc->defaultmark = 1; // Multiple-choice subquestion. question_bank::load_question_definition_classes('multichoice'); @@ -474,7 +474,7 @@ class qtype_multianswer_test_helper extends question_test_helper { 'Correct', FORMAT_HTML), ); $mc2->qtype = question_bank::get_qtype('multichoice'); - $mc2->maxmark = 1; + $mc2->defaultmark = 1; $q->subquestions = array( 1 => $mc, diff --git a/question/type/questionbase.php b/question/type/questionbase.php index cbee8a562b7..e9bf7ab4dce 100644 --- a/question/type/questionbase.php +++ b/question/type/questionbase.php @@ -88,7 +88,7 @@ abstract class question_definition { /** @var integer question test format. */ public $generalfeedbackformat; - /** @var number what this quetsion is marked out of, by default. */ + /** @var float what this quetsion is marked out of, by default. */ public $defaultmark = 1; /** @var integer How many question numbers this question consumes. */