Merge branch 'MDL-85208-500' of https://github.com/paulholden/moodle into MOODLE_500_STABLE

This commit is contained in:
Huong Nguyen
2025-04-30 10:03:48 +07:00
5 changed files with 38 additions and 36 deletions
+8 -2
View File
@@ -1693,15 +1693,21 @@ class flexible_table {
$this->request[TABLE_VAR_DIR] => $sortorder,
];
if ($order != SORT_ASC) {
$sortlabel = get_string('sortbyxreverse', 'moodle', $text);
} else {
$sortlabel = get_string('sortbyx', 'moodle', $text);
}
return html_writer::link(
$this->baseurl->out(false, $params),
$text . get_accesshide(get_string('sortby') . ' ' .
$text . ' ' . $this->sort_order_name($isprimary, $order)),
$text,
[
'data-sortable' => $this->is_sortable($column),
'data-sortby' => $column,
'data-sortorder' => $sortorder,
'role' => 'button',
'aria-label' => $sortlabel,
]
) . ' ' . $this->sort_icon($isprimary, $order);
}
@@ -41,14 +41,12 @@ Feature: Grades report for a quiz with multiple grade items
| slot | response |
| 1 | True |
| 2 | False |
When I am on the "Test quiz" "mod_quiz > Grades report" page logged in as teacher
Then "Lorna LottReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "50.00"
And "Lorna LottReview attempt" row "Q. 1/50.00Sort by Q. 1/50.00 Ascending" column of "attempts" table should contain "0.00"
And "Lorna LottReview attempt" row "Q. 2/50.00Sort by Q. 2/50.00 Ascending" column of "attempts" table should contain "0.00"
And "Lorna LottReview attempt" row "Reading/1.00Sort by Reading/1.00 Ascending" column of "attempts" table should contain "1.00"
And "Lorna LottReview attempt" row "Listening/1.00Sort by Listening/1.00 Ascending" column of "attempts" table should contain "0.00"
And I follow "Reading/1.00Sort by Reading/1.00 Ascending"
Then "Lorna LottReview attempt" row "Grade/100.00" column of "attempts" table should contain "50.00"
And "Lorna LottReview attempt" row "Q. 1/50.00" column of "attempts" table should contain "0.00"
And "Lorna LottReview attempt" row "Q. 2/50.00" column of "attempts" table should contain "0.00"
And "Lorna LottReview attempt" row "Reading/1.00" column of "attempts" table should contain "1.00"
And "Lorna LottReview attempt" row "Listening/1.00" column of "attempts" table should contain "0.00"
# Main thing to check here is that sorting does not give a fatal error
And "Lorna LottReview attempt" row "Listening/1.00Sort by Listening/1.00 Ascending" column of "attempts" table should contain "0.00"
And I click on "//a[@aria-label='Sort by Reading/1.00 ascending']" "xpath_element" in the "attempts" "table"
And "Lorna LottReview attempt" row "Listening/1.00" column of "attempts" table should contain "0.00"
@@ -92,10 +92,10 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Finished regrading (2/2)"
And I should see "Regrade completed"
And I press "Continue"
And "Student OneReview attempt" row "Q. 1/50.00Sort by Q. 1/50.00 Ascending" column of "attempts" table should contain "50.00/0.00"
And "Student TwoReview attempt" row "Q. 1/50.00Sort by Q. 1/50.00 Ascending" column of "attempts" table should contain "50.00/0.00"
And "Student OneReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "100.00/50.00"
And "Student TwoReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "90.00/40.00"
And "Student OneReview attempt" row "Q. 1/50.00" column of "attempts" table should contain "50.00/0.00"
And "Student TwoReview attempt" row "Q. 1/50.00" column of "attempts" table should contain "50.00/0.00"
And "Student OneReview attempt" row "Grade/100.00" column of "attempts" table should contain "100.00/50.00"
And "Student TwoReview attempt" row "Grade/100.00" column of "attempts" table should contain "90.00/40.00"
Scenario: Regrade selected attempts and selected questions.
Given I am on the "Quiz for testing regrading" "mod_quiz > edit" page logged in as teacher
@@ -123,8 +123,8 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Finished regrading (1/1)"
And I should see "Regrade completed"
And I press "Continue"
And "Student TwoReview attempt" row "Q. 1/50.00Sort by Q. 1/50.00 Ascending" column of "attempts" table should contain "50.00/0.00"
And "Student TwoReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "90.00/40.00"
And "Student TwoReview attempt" row "Q. 1/50.00" column of "attempts" table should contain "50.00/0.00"
And "Student TwoReview attempt" row "Grade/100.00" column of "attempts" table should contain "90.00/40.00"
Scenario: Dry-run all attempts, then regrade all attempts.
Given I am on the "Quiz for testing regrading" "mod_quiz > edit" page logged in as teacher
@@ -141,13 +141,12 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Finished regrading (2/2)"
And I should see "Regrade completed"
And I press "Continue"
And "Student One" row "Regrade" column of "attempts" table should not contain "Needed"
And "Student TwoReview attempt" row "Regrade" column of "attempts" table should contain "Needed"
# In the following, the first number is strike-through, and the second is not, but Behat can't see that.
# At this point, it is showing what would change.
And "Student TwoReview attempt" row "Q. 2/50.00Sort by Q. 2/50.00 Ascending" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "90.00/75.00"
And "Student TwoReview attempt" row "Q. 2/50.00" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00" column of "attempts" table should contain "90.00/75.00"
And I press "Regrade attempts..."
And I click on "Regrade now" "button" in the "Regrade" "dialogue"
And I should see "Quiz for testing regrading"
@@ -158,8 +157,8 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Quiz for testing regrading"
And I should see "Overall number of students achieving grade ranges"
# Now, both old-score strike-through and new score plain, are still shown, but now it indicates what did change.
And "Student TwoReview attempt" row "Q. 2/50.00Sort by Q. 2/50.00 Ascending" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "90.00/75.00"
And "Student TwoReview attempt" row "Q. 2/50.00" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00" column of "attempts" table should contain "90.00/75.00"
Scenario: Dry-run a full regrade, then regrade the commit regrade.
Given I am on the "Quiz for testing regrading" "mod_quiz > edit" page logged in as teacher
@@ -180,8 +179,8 @@ Feature: Regrading quiz attempts using the Grades report
And "Student TwoReview attempt" row "Regrade" column of "attempts" table should contain "Needed"
# In the following, the first number is strike-through, and the second is not, but Behat can't see that.
# At this point, it is showing what would change.
And "Student TwoReview attempt" row "Q. 2/50.00Sort by Q. 2/50.00 Ascending" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "90.00/75.00"
And "Student TwoReview attempt" row "Q. 2/50.00" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00" column of "attempts" table should contain "90.00/75.00"
Then I should see "The last dry run of a regrade found that the regrade would change the marks for 1 questions in 1 attempts."
And I press "Commit regrade"
And I should see "Quiz for testing regrading"
@@ -193,8 +192,8 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Quiz for testing regrading"
And I should see "Overall number of students achieving grade ranges"
# Now, both old-score strike-through and new score plain, are still shown, but now it indicates what did change.
And "Student TwoReview attempt" row "Q. 2/50.00Sort by Q. 2/50.00 Ascending" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "attempts" table should contain "90.00/75.00"
And "Student TwoReview attempt" row "Q. 2/50.00" column of "attempts" table should contain "40.00/25.00"
And "Student TwoReview attempt" row "Grade/100.00" column of "attempts" table should contain "90.00/75.00"
And I should not see "The last dry run of a regrade found that the regrade would change the marks for 1 questions in 1 attempts."
Scenario: Regrade all attempts works against quiz selected question version
@@ -227,7 +226,7 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Regrade completed"
And I press "Continue"
Then "student1@example.com" row "Regrade" column of "attempts" table should contain "Done"
And "Student OneReview attempt" row "Q. 1/50.00Sort by Q. 1/50.00 Ascending" column of "attempts" table should contain "50.00/0.00"
And "Student OneReview attempt" row "Q. 1/50.00" column of "attempts" table should contain "50.00/0.00"
And "Incorrect" "icon" should appear before "50.00/0.00" "text"
Scenario: Regrade all attempts works against quiz selected latest question version
@@ -267,7 +266,7 @@ Feature: Regrading quiz attempts using the Grades report
And I should see "Finished regrading (1/1)"
And I should see "Regrade completed"
And I press "Continue"
Then "student3@example.com" row "Q. 1/50.00Sort by Q. 1/50.00 Ascending" column of "attempts" table should contain "50.00/0.00"
Then "student3@example.com" row "Q. 1/50.00" column of "attempts" table should contain "50.00/0.00"
And "Incorrect" "icon" should appear before "50.00/0.00" "text"
Scenario: Regrade attempts should always regrade against latest random question version
@@ -300,12 +299,12 @@ Feature: Regrading quiz attempts using the Grades report
And I set the field "Correct answer" to "False"
And I press "id_submitbutton"
And I navigate to "Results" in current page administration
And "student3@example.com" row "Q. 1/100.00Sort by Q. 1/100.00 Ascending" column of "attempts" table should contain "100.00"
And "student3@example.com" row "Q. 1/100.00" column of "attempts" table should contain "100.00"
And "Correct" "icon" should be visible
And I press "Regrade attempts..."
And I click on "Regrade now" "button" in the "Regrade" "dialogue"
And I should see "Finished regrading (1/1)"
And I should see "Regrade completed"
And I press "Continue"
Then "student3@example.com" row "Q. 1/100.00Sort by Q. 1/100.00 Ascending" column of "attempts" table should contain "100.00/0.00"
Then "student3@example.com" row "Q. 1/100.00" column of "attempts" table should contain "100.00/0.00"
And "Incorrect" "icon" should be visible
@@ -51,7 +51,6 @@ Feature: Basic use of the Responses report
| slot | response |
| 1 | 3.14 |
And user "student1" has finished an attempt at quiz "Quiz 1"
When I am on the "Quiz 1" "mod_quiz > Responses report" page logged in as teacher
Then I should see "Attempts: 1"
And I should see "Student One"
@@ -60,12 +59,12 @@ Feature: Basic use of the Responses report
And I set the field "Which tries" to "All tries"
And I should see "Response 1a"
And I press "Show report"
And "Student OneReview attempt" row "Response 1aSort by Response 1a Ascending" column of "responses" table should contain "1.0"
And "Student OneReview attempt" row "Response 1a" column of "responses" table should contain "1.0"
And "Student OneReview attempt" row "Status" column of "responses" table should contain ""
And "Finished" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "responses" table should contain "33.33"
And "Finished" row "Response 1aSort by Response 1a Ascending" column of "responses" table should contain "3.14"
And "Finished" row "Grade/100.00" column of "responses" table should contain "33.33"
And "Finished" row "Response 1a" column of "responses" table should contain "3.14"
And "Student Two" row "Status" column of "responses" table should contain "-"
And "Student Two" row "Response 1aSort by Response 1a Ascending" column of "responses" table should contain "-"
And "Student Two" row "Response 1a" column of "responses" table should contain "-"
@javascript
Scenario: Report does not allow strange combinations of options
@@ -78,7 +78,7 @@ Feature: Manage custom report columns sorting
And I click on "Switch to preview mode" "button"
And "user02" "table_row" should appear before "user01" "table_row"
# Custom sorting for the user.
And I click on "Sort by First name Ascending" "link"
And I click on "//a[@aria-label='Sort by First name ascending']" "xpath_element" in the "Users" "table"
And "user01" "table_row" should appear before "user02" "table_row"
# Switching back to edit mode should observe report config.
And I click on "Switch to edit mode" "button"