diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index 0205195e021..0e7d1286b35 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -1925,8 +1925,12 @@ class quiz_attempt { } /** - * Replace a question in an attempt with a new attempt at the same qestion. - * @param int $slot the questoin to restart. + * Replace a question in an attempt with a new attempt at the same question. + * + * Well, for randomised questions, it won't be the same question, it will be + * a different randomised selection. + * + * @param int $slot the question to restart. * @param int $timestamp the timestamp to record for this action. */ public function process_redo_question($slot, $timestamp) { @@ -1938,7 +1942,7 @@ class quiz_attempt { } $qubaids = new \mod_quiz\question\qubaids_for_users_attempts( - $this->get_quizid(), $this->get_userid()); + $this->get_quizid(), $this->get_userid(), 'all', true); $transaction = $DB->start_delegated_transaction(); diff --git a/mod/quiz/tests/behat/attempt_redo_questions.feature b/mod/quiz/tests/behat/attempt_redo_questions.feature index fbadb44b45f..4398197f23f 100644 --- a/mod/quiz/tests/behat/attempt_redo_questions.feature +++ b/mod/quiz/tests/behat/attempt_redo_questions.feature @@ -128,11 +128,16 @@ Feature: Allow students to redo questions in a practice quiz, without starting a And quiz "Quiz 2" contains the following questions: | question | page | | Random (Test questions) | 1 | + And user "student" has started an attempt at quiz "Quiz 2" randomised as follows: + | slot | actualquestion | + | 1 | TF1 | And I log in as "student" And I am on "Course 1" course homepage When I follow "Quiz 2" - And I press "Attempt quiz now" + And I press "Continue the last attempt" + And I should see "First question" And I click on "False" "radio" And I click on "Check" "button" And I press "Try another question like this one" - Then "Check" "button" should exist + Then I should see "Second question" + And "Check" "button" should exist diff --git a/mod/quiz/tests/behat/behat_mod_quiz.php b/mod/quiz/tests/behat/behat_mod_quiz.php index cfa4e459281..0269b75736b 100644 --- a/mod/quiz/tests/behat/behat_mod_quiz.php +++ b/mod/quiz/tests/behat/behat_mod_quiz.php @@ -631,7 +631,8 @@ class behat_mod_quiz extends behat_question_base { * random questions. If so, this will let you control which actual * question gets picked when this slot is 'randomised' at the * start of the attempt. If you don't specify, then one will be picked - * at random (which might make the reponse meaningless). + * at random (which might make the response meaningless). + * Give the question name. * variant This column is similar, and also options. It is only needed if * the question that ends up in this slot returns something greater * than 1 for $question->get_num_variants(). Like with actualquestion, @@ -708,7 +709,7 @@ class behat_mod_quiz extends behat_question_base { * @param string $username the username of the user that will attempt. * @param string $quizname the name of the quiz the user will attempt. * @param TableNode $attemptinfo information about the questions to add, as above. - * @Given /^user "([^"]*)" has started an attempt at quiz "([^"]*) randomised as follows:"$/ + * @Given /^user "([^"]*)" has started an attempt at quiz "([^"]*)" randomised as follows:$/ */ public function user_has_started_an_attempt_at_quiz_with_details($username, $quizname, TableNode $attemptinfo) { global $DB;