MDL-28024 adaptive qbehaviour. Displayed penalties not rounded correctly.

This commit is contained in:
Tim Hunt
2011-06-24 14:26:49 +01:00
parent 50d32a2baf
commit 5cc532e8e9
2 changed files with 14 additions and 4 deletions
+10 -3
View File
@@ -77,7 +77,7 @@ class qbehaviour_adaptive_renderer extends qbehaviour_renderer {
$gradingdetails = get_string('gradingdetails', 'qbehaviour_adaptive', $mark);
$gradingdetails .= $this->penalty_info($qa, $mark);
$gradingdetails .= $this->penalty_info($qa, $mark, $options);
$output = '';
$output .= html_writer::tag('div', get_string($class, 'question'),
@@ -87,7 +87,14 @@ class qbehaviour_adaptive_renderer extends qbehaviour_renderer {
return $output;
}
protected function penalty_info($qa, $mark) {
/**
* Display the information about the penalty calculations.
* @param question_attempt $qa the question attempt.
* @param object $mark contains information about the current mark.
* @param question_display_options $options display options.
*/
protected function penalty_info(question_attempt $qa, $mark,
question_display_options $options) {
if (!$qa->get_question()->penalty) {
return '';
}
@@ -102,7 +109,7 @@ class qbehaviour_adaptive_renderer extends qbehaviour_renderer {
// penalty is relevant only if the answer is not correct and further attempts are possible
if (!$qa->get_state()->is_finished()) {
$output .= ' ' . get_string('gradingdetailspenalty', 'qbehaviour_adaptive',
$qa->get_question()->penalty);
format_float($qa->get_question()->penalty, $options->markdp));
}
return $output;
@@ -101,7 +101,10 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
$this->get_contains_mc_radio_expectation($rightindex, true, true),
$this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, true, false),
$this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false),
$this->get_contains_correct_expectation());
$this->get_contains_correct_expectation(),
new PatternExpectation('/' . preg_quote(
get_string('gradingdetailspenalty', 'qbehaviour_adaptive',
format_float($mc->penalty, $this->displayoptions->markdp))) . '/'));
$this->assertEqual('A',
$this->quba->get_response_summary($this->slot));