MDL-81315 gradereport_user: Add the missing 'Grade analysis' link

The following change adds the missing 'Grade analysis' link that some
activities such as quizzes, LTI external tools, etc. need so support.
The link to the relevant 'Grade analysis' page is now located in a
contextual menu within the grade column of the gradebook's user report.
This commit is contained in:
Mihail Geshoski
2024-03-26 23:25:19 +08:00
parent 342319339f
commit 5c1968ae46
3 changed files with 28 additions and 2 deletions
@@ -739,6 +739,13 @@ class user extends grade_report {
}
$data['grade']['headers'] = "$headercat $headerrow grade$userid";
$gradeitemdata['gradeformatted'] = $data['grade']['content'];
// If the current grade item need to show a grade action menu, generate the appropriate output.
if ($gradeactionmenu = $this->gtree->get_grade_action_menu($gradegrade)) {
$gradecontainer = html_writer::div($data['grade']['content']);
$grademenucontainer = html_writer::div($gradeactionmenu, 'pl-1 d-flex align-items-center');
$data['grade']['content'] = html_writer::div($gradecontainer . $grademenucontainer,
'd-flex align-items-center');
}
}
// Range.
+2 -1
View File
@@ -183,7 +183,8 @@
.path-grade-report-user .user-grade th.category a.toggle-category,
.grade-report-user .user-grade th.category a.toggle-category
.path-grade-report-user #page-footer {
.path-grade-report-user #page-footer,
.path-grade-report-user .user-grade td.column-grade .action-menu {
display: none;
}
}
@@ -48,6 +48,9 @@ Feature: View the user report as the student will see it
And I change window size to "medium"
Scenario: View the report as the teacher themselves
Given the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| quiz | C1 | q1 | Test quiz one | Submit something! | 100 |
When I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And I should see "Course 1 & '\""
@@ -63,9 +66,16 @@ Feature: View the user report as the student will see it
| Sub category 2 total | 33.33 % | 150.00 | 0200 | 75.00 % | - |
| Test assignment five | 16.67 % | 21.00 | 0100 | 21.00 % | 3.50 % |
| Test assignment six | 16.67 % | 97.00 | 0100 | 97.00 % | 16.17 % |
| Test quiz one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Course total | - | 383.00 | 0600 | 63.83 % | - |
# Confirm a contextual menu with a link to the Grade analysis page is available for "Test quiz one".
And I open the action menu in "Test quiz one" "table_row"
And "Grade analysis" "link" should exist
Scenario: View the report as the student from both the teachers and students perspective
Given the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| quiz | C1 | q1 | Test quiz one | Submit something! | 100 |
When I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And I set the field "View report as" to "User"
@@ -75,6 +85,7 @@ Feature: View the user report as the student will see it
| Test assignment two | - | 35.00 | 0100 | 35.00 % | - |
| Sub category 1 total | 33.33 % | - | 0200 | - | - |
| Test assignment five | - | 21.00 | 0100 | 21.00 % | - |
| Test quiz one | - | - | 0100 | - | - |
| Course total | - | - | 0600 | - | - |
And "//i[@aria-label='Pass']" "xpath_element" should exist in the "Test assignment one" "table_row"
And "//i[@aria-label='Fail']" "xpath_element" should exist in the "Test assignment two" "table_row"
@@ -84,15 +95,19 @@ Feature: View the user report as the student will see it
| Test assignment four |
| Sub category 2 total |
| Test assignment six |
# Confirm a contextual menu with a link to the Grade analysis page is available for "Test quiz one".
And I open the action menu in "Test quiz one" "table_row"
And "Grade analysis" "link" should exist
And I log out
And I am on the "C1" "Course" page logged in as "student1"
And I navigate to "User report" in the course gradebook
Then the following should exist in the "user-grade" table:
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | - | 80.00 | 0100 | 80.00 % | - |
| Test assignment two | - | 35.00 | 0100 | 35.00 % | - |
| Sub category 1 total | 33.33 % | - | 0200 | - | - |
| Test assignment five | - | 21.00 | 0100 | 21.00 % | - |
| Test quiz one | - | - | 0100 | - | - |
| Course total | - | - | 0600 | - | - |
And "//i[@aria-label='Pass']" "xpath_element" should exist in the "Test assignment one" "table_row"
And "//i[@aria-label='Fail']" "xpath_element" should exist in the "Test assignment two" "table_row"
@@ -102,6 +117,9 @@ Feature: View the user report as the student will see it
| Test assignment four |
| Sub category 2 total |
| Test assignment six |
# Confirm a contextual menu with a link to the Grade analysis page is available for "Test quiz one".
And I open the action menu in "Test quiz one" "table_row"
And "Grade analysis" "link" should exist
Scenario: View the report as the student from both the teachers and students perspective with totals excluding hidden
Given I navigate to "Setup > Course grade settings" in the course gradebook