Skip to content

Commit

Permalink
Merge branch 'MDL-77440_400' of https://github.com/timhunt/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_400_STABLE
  • Loading branch information
sarjona committed Mar 8, 2023
2 parents c57bb01 + 5c26133 commit ff43757
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
4 changes: 3 additions & 1 deletion mod/quiz/reviewquestion.php
Expand Up @@ -101,7 +101,9 @@

// Other attempts at the quiz.
if ($attemptobj->has_capability('mod/quiz:viewreports')) {
$attemptlist = $attemptobj->links_to_other_attempts($baseurl);
$otherattemptsurl = clone($baseurl);
$otherattemptsurl->param('slot', $attemptobj->get_original_slot($slot));
$attemptlist = $attemptobj->links_to_other_attempts($otherattemptsurl);
if ($attemptlist) {
$summarydata['attemptlist'] = array(
'title' => get_string('attempts', 'quiz'),
Expand Down
32 changes: 30 additions & 2 deletions mod/quiz/tests/behat/attempt_redo_questions.feature
Expand Up @@ -115,15 +115,15 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
@javascript @_switch_window
Scenario: Teachers reviewing can see all the questions attempted in a slot
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
When I press "Attempt quiz"
And I press "Attempt quiz"
And I click on "False" "radio" in the "First question" "question"
And I click on "Check" "button" in the "First question" "question"
And I press "Try another question like this one"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
And I log out
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
And I follow "Attempts: 1"
And I follow "Review attempt"
And I click on "1" "link" in the "First question" "question"
Expand All @@ -140,6 +140,34 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
And "True" row "Frequency" column of "quizresponseanalysis" table should contain "0.00%"
And "[No response]" row "Frequency" column of "quizresponseanalysis" table should contain "100.00%"

@javascript @_switch_window
Scenario: Teachers reviewing can switch between attempts in the review question popup
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as student
# Create two attempts, only one of which has a redo.
When I press "Attempt quiz"
And I click on "False" "radio" in the "First question" "question"
And I click on "Check" "button" in the "First question" "question"
And I press "Try another question like this one"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
And I follow "Finish review"
And I press "Re-attempt quiz"
And I click on "True" "radio" in the "First question" "question"
And I click on "Check" "button" in the "First question" "question"
And I log out
And I am on the "Quiz 1" "mod_quiz > View" page logged in as teacher
And I follow "Attempts: 2"
# Review the first attempt - and switch to the first question seen.
And I follow "Review attempt"
And I click on "1" "link" in the "First question" "question"
And I switch to "reviewquestion" window
And the state of "First question" question is shown as "Incorrect"
# Now switch to the other quiz attempt using the link at the top, which does not have a redo.
And I click on "2" "link" in the "Attempts" "table_row"
Then the state of "First question" question is shown as "Correct"
And I should not see "Other questions attempted here"

@javascript
Scenario: Redoing question 1 should save any changes to question 2 on the same page
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
Expand Down

0 comments on commit ff43757

Please sign in to comment.