MDL-32188 question CBM: use short certainty name in response summaries.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 3 Oct 2013 15:25:39 +0000 (16:25 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 4 Oct 2013 20:46:47 +0000 (21:46 +0100)
question/behaviour/behaviourbase.php
question/behaviour/deferredcbm/behaviour.php
question/behaviour/deferredcbm/tests/walkthrough_test.php
question/behaviour/immediatecbm/tests/walkthrough_test.php

index ff4b98e..b3b476a 100644 (file)
@@ -718,12 +718,13 @@ abstract class question_cbm {
      * Add information about certainty to a response summary.
      * @param string $summary the response summary.
      * @param int $certainty the level of certainty to add.
+     * @return string the summary with information about the certainty added.
      */
     public static function summary_with_certainty($summary, $certainty) {
         if (is_null($certainty)) {
             return $summary;
         }
-        return $summary . ' [' . self::get_string($certainty) . ']';
+        return $summary . ' [' . self::get_short_string($certainty) . ']';
     }
 
     /**
index 6df93c1..04abd7a 100644 (file)
@@ -62,7 +62,7 @@ class qbehaviour_deferredcbm extends qbehaviour_deferredfeedback {
 
     public function get_right_answer_summary() {
         $summary = parent::get_right_answer_summary();
-        return $summary . ' [' . question_cbm::get_string(question_cbm::HIGH) . ']';
+        return question_cbm::summary_with_certainty($summary, question_cbm::HIGH);
     }
 
     public function get_correct_response() {
index f483562..9417dfe 100644 (file)
@@ -151,7 +151,7 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
         $this->check_current_output($this->get_contains_correct_expectation(),
                 $this->get_contains_cbm_radio_expectation(1, false, true));
         $this->assertEquals(get_string('true', 'qtype_truefalse') . ' [' .
-                question_cbm::get_string(question_cbm::LOW) . ']',
+                question_cbm::get_short_string(question_cbm::LOW) . ']',
                 $this->quba->get_response_summary($this->slot));
     }
 
@@ -207,11 +207,11 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
                 $this->get_contains_mc_radio_expectation($wrongindex, false, true),
                 $this->get_contains_cbm_radio_expectation(2, false, true),
                 $this->get_contains_incorrect_expectation());
-        $this->assertEquals('A [' . question_cbm::get_string(question_cbm::HIGH) . ']',
+        $this->assertEquals('A [' . question_cbm::get_short_string(question_cbm::HIGH) . ']',
                 $this->quba->get_right_answer_summary($this->slot));
         $this->assertRegExp('/' . preg_quote($mc->questiontext, '/') . '/',
                 $this->quba->get_question_summary($this->slot));
-        $this->assertRegExp('/(B|C) \[' . preg_quote(question_cbm::get_string(question_cbm::MED), '/') . '\]/',
+        $this->assertRegExp('/(B|C) \[' . preg_quote(question_cbm::get_short_string(question_cbm::MED), '/') . '\]/',
                 $this->quba->get_response_summary($this->slot));
 
         // Save the old attempt.
@@ -232,7 +232,7 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
                 $this->get_contains_cbm_radio_expectation(2, true, true),
                 $this->get_does_not_contain_feedback_expectation(),
                 $this->get_does_not_contain_correctness_expectation());
-        $this->assertEquals('A [' . question_cbm::get_string(question_cbm::HIGH) . ']',
+        $this->assertEquals('A [' . question_cbm::get_short_string(question_cbm::HIGH) . ']',
                 $this->quba->get_right_answer_summary($this->slot));
         $this->assertRegExp('/' . preg_quote($mc->questiontext, '/') . '/',
                 $this->quba->get_question_summary($this->slot));
@@ -249,7 +249,7 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
                 $this->get_contains_mc_radio_expectation($rightindex, false, true),
                 $this->get_contains_cbm_radio_expectation(question_cbm::HIGH, false, true),
                 $this->get_contains_correct_expectation());
-        $this->assertRegExp('/(A) \[' . preg_quote(question_cbm::get_string(question_cbm::HIGH), '/') . '\]/',
+        $this->assertRegExp('/(A) \[' . preg_quote(question_cbm::get_short_string(question_cbm::HIGH), '/') . '\]/',
                 $this->quba->get_response_summary($this->slot));
     }
 
index 6610629..794cae0 100644 (file)
@@ -58,7 +58,7 @@ class qbehaviour_immediatecbm_walkthrough_test extends qbehaviour_walkthrough_te
                 $this->get_contains_mc_radio_expectation(2, true, false),
                 $this->get_contains_submit_button_expectation(true),
                 $this->get_does_not_contain_feedback_expectation());
-        $this->assertEquals('A [' . question_cbm::get_string(question_cbm::HIGH) . ']',
+        $this->assertEquals('A [' . question_cbm::get_short_string(question_cbm::HIGH) . ']',
                 $this->quba->get_right_answer_summary($this->slot));
         $this->assertRegExp('/' . preg_quote($mc->questiontext, '/') . '/',
                 $this->quba->get_question_summary($this->slot));
@@ -90,7 +90,7 @@ class qbehaviour_immediatecbm_walkthrough_test extends qbehaviour_walkthrough_te
                 $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false),
                 $this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false),
                 $this->get_contains_correct_expectation());
-        $this->assertEquals('A [' . question_cbm::get_string(2) . ']',
+        $this->assertEquals('A [' . question_cbm::get_short_string(2) . ']',
                 $this->quba->get_response_summary($this->slot));
 
         $numsteps = $this->get_step_count();