mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-20636 Fix codechecker issues in the question behaviours.
This commit is contained in:
parent
9447399c11
commit
1631ceeaec
21 changed files with 147 additions and 86 deletions
|
@ -85,11 +85,13 @@ class qbehaviour_deferredcbm extends qbehaviour_deferredfeedback {
|
|||
|
||||
protected function is_same_response($pendingstep) {
|
||||
return parent::is_same_response($pendingstep) &&
|
||||
$this->qa->get_last_behaviour_var('certainty') == $pendingstep->get_behaviour_var('certainty');
|
||||
$this->qa->get_last_behaviour_var('certainty') ==
|
||||
$pendingstep->get_behaviour_var('certainty');
|
||||
}
|
||||
|
||||
protected function is_complete_response($pendingstep) {
|
||||
return parent::is_complete_response($pendingstep) && $pendingstep->has_behaviour_var('certainty');
|
||||
return parent::is_complete_response($pendingstep) &&
|
||||
$pendingstep->has_behaviour_var('certainty');
|
||||
}
|
||||
|
||||
public function process_finish(question_attempt_pending_step $pendingstep) {
|
||||
|
|
|
@ -75,21 +75,25 @@ class qbehaviour_deferredcbm_renderer extends qbehaviour_renderer {
|
|||
return '';
|
||||
}
|
||||
|
||||
if ($qa->get_state() == question_state::$gaveup || $qa->get_state() == question_state::$mangaveup) {
|
||||
if ($qa->get_state() == question_state::$gaveup || $qa->get_state() ==
|
||||
question_state::$mangaveup) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$feedback = '';
|
||||
if (!$qa->get_last_behaviour_var('certainty') && $qa->get_last_behaviour_var('_assumedcertainty')) {
|
||||
$feedback .= html_writer::tag('p', get_string('assumingcertainty', 'qbehaviour_deferredcbm',
|
||||
if (!$qa->get_last_behaviour_var('certainty') &&
|
||||
$qa->get_last_behaviour_var('_assumedcertainty')) {
|
||||
$feedback .= html_writer::tag('p',
|
||||
get_string('assumingcertainty', 'qbehaviour_deferredcbm',
|
||||
question_cbm::get_string($qa->get_last_behaviour_var('_assumedcertainty'))));
|
||||
}
|
||||
|
||||
if ($options->marks >= question_display_options::MARK_AND_MAX) {
|
||||
$a->rawmark = format_float(
|
||||
$qa->get_last_behaviour_var('_rawfraction') * $qa->get_max_mark(), $options->markdp);
|
||||
$a->rawmark = format_float($qa->get_last_behaviour_var('_rawfraction') *
|
||||
$qa->get_max_mark(), $options->markdp);
|
||||
$a->mark = $qa->format_mark($options->markdp);
|
||||
$feedback .= html_writer::tag('p', get_string('markadjustment', 'qbehaviour_deferredcbm', $a));
|
||||
$feedback .= html_writer::tag('p',
|
||||
get_string('markadjustment', 'qbehaviour_deferredcbm', $a));
|
||||
}
|
||||
|
||||
return $feedback;
|
||||
|
|
|
@ -100,7 +100,8 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
|
|||
// Verify.
|
||||
$this->check_current_state(question_state::$mangrpartial);
|
||||
$this->check_current_mark(1);
|
||||
$this->check_current_output(new PatternExpectation('/' . preg_quote('Not good enough!') . '/'));
|
||||
$this->check_current_output(new PatternExpectation('/' .
|
||||
preg_quote('Not good enough!') . '/'));
|
||||
|
||||
// Now change the correct answer to the question, and regrade.
|
||||
$tf->rightanswer = false;
|
||||
|
@ -145,7 +146,8 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
|
|||
$this->check_current_mark(0.6666667);
|
||||
$this->check_current_output($this->get_contains_correct_expectation(),
|
||||
$this->get_contains_cbm_radio_expectation(1, false, true));
|
||||
$this->assertEqual(get_string('true', 'qtype_truefalse') . ' [' . question_cbm::get_string(1) . ']',
|
||||
$this->assertEqual(get_string('true', 'qtype_truefalse') . ' [' .
|
||||
question_cbm::get_string(1) . ']',
|
||||
$this->quba->get_response_summary($this->slot));
|
||||
}
|
||||
|
||||
|
@ -173,8 +175,10 @@ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_tes
|
|||
$this->check_current_mark(0.6666667);
|
||||
$this->check_current_output($this->get_contains_correct_expectation(),
|
||||
$this->get_contains_cbm_radio_expectation(1, false, false),
|
||||
new PatternExpectation('/' . preg_quote(get_string('assumingcertainty', 'qbehaviour_deferredcbm',
|
||||
question_cbm::get_string($qa->get_last_behaviour_var('_assumedcertainty')))) . '/'));
|
||||
new PatternExpectation('/' . preg_quote(
|
||||
get_string('assumingcertainty', 'qbehaviour_deferredcbm',
|
||||
question_cbm::get_string(
|
||||
$qa->get_last_behaviour_var('_assumedcertainty')))) . '/'));
|
||||
$this->assertEqual(get_string('true', 'qtype_truefalse'),
|
||||
$this->quba->get_response_summary($this->slot));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue