MDL-32188 question CBM: use short certainty name in response summaries.

This commit is contained in:
Tim Hunt 2013-10-03 16:25:39 +01:00
parent 2bf83cb218
commit 8b9ef25ea2
4 changed files with 10 additions and 9 deletions

View 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) . ']';
}
/**

View 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() {

View 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));
}

View 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();