MDL-29771 interactive behaviour: better state text in try again state
Before it just said 'Not complete'. It is more helpful to show the number of tries remaining in this state as well.
This commit is contained in:
@@ -136,12 +136,8 @@ class qbehaviour_interactive extends question_behaviour_with_multiple_tries {
|
||||
return parent::get_state_string($showcorrectness);
|
||||
}
|
||||
|
||||
if ($this->is_try_again_state()) {
|
||||
return get_string('notcomplete', 'qbehaviour_interactive');
|
||||
} else {
|
||||
return get_string('triesremaining', 'qbehaviour_interactive',
|
||||
$this->qa->get_last_behaviour_var('_triesleft'));
|
||||
}
|
||||
return get_string('triesremaining', 'qbehaviour_interactive',
|
||||
$this->qa->get_last_behaviour_var('_triesleft'));
|
||||
}
|
||||
|
||||
public function init_first_step(question_attempt_step $step, $variant) {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['notcomplete'] = 'Not complete';
|
||||
$string['pluginname'] = 'Interactive with multiple tries';
|
||||
$string['triesremaining'] = 'Tries remaining: {$a}';
|
||||
$string['tryagain'] = 'Try again';
|
||||
|
||||
@@ -98,8 +98,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('notcomplete', 'qbehaviour_interactive'), '/') . '/'),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
|
||||
// Check that, if we review in this state, the try again button is disabled.
|
||||
@@ -223,8 +222,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('notcomplete', 'qbehaviour_interactive'), '/') . '/'),
|
||||
new question_pattern_expectation('/Tries remaining: 1/'),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
|
||||
// Finish the attempt.
|
||||
@@ -288,8 +286,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('notcomplete', 'qbehaviour_interactive'), '/') . '/'),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
$this->assertEquals('newt',
|
||||
$this->quba->get_response_summary($this->slot));
|
||||
@@ -386,8 +383,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('notcomplete', 'qbehaviour_interactive'), '/') . '/'),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
$this->get_contains_hint_expectation('This is the first hint'),
|
||||
$this->get_contains_num_parts_correct(1),
|
||||
$this->get_contains_standard_incorrect_combined_feedback_expectation(),
|
||||
|
||||
@@ -90,8 +90,7 @@ class qbehaviour_interactivecountback_walkthrough_test extends qbehaviour_walkth
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('notcomplete', 'qbehaviour_interactive'), '/') . '/'),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
$this->get_contains_hint_expectation('This is the first hint'),
|
||||
$this->get_contains_num_parts_correct(2),
|
||||
$this->get_contains_standard_partiallycorrect_combined_feedback_expectation(),
|
||||
|
||||
@@ -422,8 +422,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('notcomplete', 'qbehaviour_interactive'), '/') . '/'),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
$this->get_contains_hint_expectation('This is the first hint.'));
|
||||
|
||||
// Check that extract responses will return the reset data.
|
||||
|
||||
Reference in New Issue
Block a user