Permalink
Browse files

MDL-29772 Adaptive question behaviour: improve penalty information

(bugfix backport to Moodle 2.1)
fixes MDL-29780: suppress penalty information if question penalty is 0
  • Loading branch information...
1 parent 9283723 commit 506934b53d52f82eabf145f14ebc3a4baee6170b @bostelm bostelm committed Dec 12, 2011
@@ -88,7 +88,9 @@ public function feedback(question_attempt $qa, question_display_options $options
*/
protected function penalty_info(question_attempt $qa, $mark,
question_display_options $options) {
- if (!$qa->get_question()->penalty) {
+
+ $currentpenalty = $qa->get_question()->penalty * $qa->get_max_mark();
+ if ($currentpenalty == 0) {
return '';
}
$output = '';
@@ -101,7 +103,7 @@ protected function penalty_info(question_attempt $qa, $mark,
// Print information about any new penalty, only relevant if the answer can be improved.
if ($qa->get_behaviour()->is_state_improvable($qa->get_state())) {
$output .= ' ' . get_string('gradingdetailspenalty', 'qbehaviour_adaptive',
- format_float($qa->get_question()->penalty, $options->markdp));
+ format_float($currentpenalty, $options->markdp));
}
return $output;
@@ -85,7 +85,7 @@ public function test_adaptive_multichoice() {
$this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false),
$this->get_contains_mc_radio_expectation(($wrongindex + 2) % 3, true, false),
$this->get_contains_incorrect_expectation(),
- $this->get_contains_penalty_info_expectation(0.33));
+ $this->get_contains_penalty_info_expectation(1.00));
$this->assertPattern('/B|C/',
$this->quba->get_response_summary($this->slot));

0 comments on commit 506934b

Please sign in to comment.