Skip to content
Permalink
Browse files

MDL-37784 Adaptive no penalty display wrong penalty info

Adaptive Mode tells students they have been penalized even when set to no penalties
  • Loading branch information
Jean-Michel Vedrine
Jean-Michel Vedrine committed Apr 22, 2013
1 parent d298661 commit 37eadb417b92abc0b92538300aec89386bb6be24
@@ -38,9 +38,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qbehaviour_adaptivenopenalty_renderer extends qbehaviour_adaptive_renderer {
protected function penalty_info(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
return '';
protected function grading_details(qbehaviour_adaptive_mark_details $details, question_display_options $options) {
$mark = $details->get_formatted_marks($options->markdp);
return get_string('gradingdetails', 'qbehaviour_adaptive', $mark);
}
protected function disregarded_info() {
return '';
}
@@ -44,6 +44,18 @@ protected function get_does_not_contain_gradingdetails_expectation() {
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() {
// Create a multiple choice, single response question.
@@ -77,7 +89,9 @@ public function test_multichoice() {
$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 + 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->quba->get_response_summary($this->slot));
@@ -106,7 +120,9 @@ public function test_multichoice() {
$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 + 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->quba->get_response_summary($this->slot));
@@ -176,7 +192,9 @@ public function test_multichoice2() {
$this->check_current_output(
$this->get_contains_mark_summary(2),
$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.
$numsteps = $this->get_step_count();
@@ -237,6 +255,8 @@ public function test_numerical_invalid() {
$this->get_contains_mark_summary(0),
$this->get_contains_submit_button_expectation(true),
$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());
// Submit another non-numerical answer.

0 comments on commit 37eadb4

Please sign in to comment.
You can’t perform that action at this time.