mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-37784 Adaptive no penalty display wrong penalty info
Adaptive Mode tells students they have been penalized even when set to no penalties
This commit is contained in:
parent
d298661993
commit
37eadb417b
2 changed files with 27 additions and 5 deletions
|
@ -38,9 +38,11 @@ require_once(dirname(__FILE__) . '/../adaptive/renderer.php');
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
class qbehaviour_adaptivenopenalty_renderer extends qbehaviour_adaptive_renderer {
|
class qbehaviour_adaptivenopenalty_renderer extends qbehaviour_adaptive_renderer {
|
||||||
protected function penalty_info(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
|
protected function grading_details(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
|
||||||
return '';
|
$mark = $details->get_formatted_marks($options->markdp);
|
||||||
|
return get_string('gradingdetails', 'qbehaviour_adaptive', $mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function disregarded_info() {
|
protected function disregarded_info() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,18 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||||
return new question_no_pattern_expectation('/class="gradingdetails"/');
|
return new question_no_pattern_expectation('/class="gradingdetails"/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function get_does_not_contain_penalty_info_expectation() {
|
||||||
|
$penaltyinfo = get_string('gradingdetailspenalty', 'qbehaviour_adaptive', 'XXXXX');
|
||||||
|
$penaltypattern = '/'.str_replace('XXXXX', '\\w*', preg_quote($penaltyinfo, '/')).'/';
|
||||||
|
return new question_no_pattern_expectation($penaltypattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_does_not_contain_total_penalty_expectation() {
|
||||||
|
$penaltyinfo = get_string('gradingdetailspenaltytotal', 'qbehaviour_adaptive', 'XXXXX');
|
||||||
|
$penaltypattern = '/'.str_replace('XXXXX', '\\w*', preg_quote($penaltyinfo, '/')).'/';
|
||||||
|
return new question_no_pattern_expectation($penaltypattern);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_multichoice() {
|
public function test_multichoice() {
|
||||||
|
|
||||||
// Create a multiple choice, single response question.
|
// Create a multiple choice, single response question.
|
||||||
|
@ -77,7 +89,9 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||||
$this->get_contains_mc_radio_expectation($wrongindex, true, true),
|
$this->get_contains_mc_radio_expectation($wrongindex, true, true),
|
||||||
$this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, true, false),
|
$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_mc_radio_expectation(($wrongindex + 2) % 3, true, false),
|
||||||
$this->get_contains_incorrect_expectation());
|
$this->get_contains_incorrect_expectation(),
|
||||||
|
$this->get_does_not_contain_penalty_info_expectation(),
|
||||||
|
$this->get_does_not_contain_total_penalty_expectation());
|
||||||
$this->assertRegExp('/B|C/',
|
$this->assertRegExp('/B|C/',
|
||||||
$this->quba->get_response_summary($this->slot));
|
$this->quba->get_response_summary($this->slot));
|
||||||
|
|
||||||
|
@ -106,7 +120,9 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||||
$this->get_contains_mc_radio_expectation($rightindex, true, true),
|
$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 + 1) % 3, true, false),
|
||||||
$this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false),
|
$this->get_contains_mc_radio_expectation(($rightindex + 2) % 3, true, false),
|
||||||
$this->get_contains_correct_expectation());
|
$this->get_contains_correct_expectation(),
|
||||||
|
$this->get_does_not_contain_penalty_info_expectation(),
|
||||||
|
$this->get_does_not_contain_total_penalty_expectation());
|
||||||
$this->assertEquals('A',
|
$this->assertEquals('A',
|
||||||
$this->quba->get_response_summary($this->slot));
|
$this->quba->get_response_summary($this->slot));
|
||||||
|
|
||||||
|
@ -176,7 +192,9 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||||
$this->check_current_output(
|
$this->check_current_output(
|
||||||
$this->get_contains_mark_summary(2),
|
$this->get_contains_mark_summary(2),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_contains_correct_expectation());
|
$this->get_contains_correct_expectation(),
|
||||||
|
$this->get_does_not_contain_penalty_info_expectation(),
|
||||||
|
$this->get_does_not_contain_total_penalty_expectation());
|
||||||
|
|
||||||
// Save the same correct answer again. Should no do anything.
|
// Save the same correct answer again. Should no do anything.
|
||||||
$numsteps = $this->get_step_count();
|
$numsteps = $this->get_step_count();
|
||||||
|
@ -237,6 +255,8 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||||
$this->get_contains_mark_summary(0),
|
$this->get_contains_mark_summary(0),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_contains_incorrect_expectation(),
|
$this->get_contains_incorrect_expectation(),
|
||||||
|
$this->get_does_not_contain_penalty_info_expectation(),
|
||||||
|
$this->get_does_not_contain_total_penalty_expectation(),
|
||||||
$this->get_does_not_contain_validation_error_expectation());
|
$this->get_does_not_contain_validation_error_expectation());
|
||||||
|
|
||||||
// Submit another non-numerical answer.
|
// Submit another non-numerical answer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue