From 6cec07a34eb6c3bd91d4920668cbff8307280fc6 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Tue, 21 May 2024 10:50:16 +0100 Subject: [PATCH] MDL-81514 assign: Enable filtering by non-participation groups This adds non-participation groups to the group menu on the Submissions screen, so that submissions can be filtered by these groups. --- .../classes/output/grading_actionmenu.php | 2 +- public/mod/assign/gradingtable.php | 2 +- .../tests/behat/group_submission.feature | 38 ++++++++++++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/public/mod/assign/classes/output/grading_actionmenu.php b/public/mod/assign/classes/output/grading_actionmenu.php index 190dea8484f..537b4457e0b 100644 --- a/public/mod/assign/classes/output/grading_actionmenu.php +++ b/public/mod/assign/classes/output/grading_actionmenu.php @@ -146,7 +146,7 @@ class grading_actionmenu implements templatable, renderable { $data['initialselector'] = $initialselector->export_for_template($output); if (groups_get_activity_groupmode($cm, $course)) { - $gs = new group_selector($PAGE->context); + $gs = new group_selector($PAGE->context, false); $data['groupselector'] = $gs->export_for_template($output); } diff --git a/public/mod/assign/gradingtable.php b/public/mod/assign/gradingtable.php index 3e4d25aeed6..d73c2f3d709 100644 --- a/public/mod/assign/gradingtable.php +++ b/public/mod/assign/gradingtable.php @@ -109,7 +109,7 @@ class assign_grading_table extends table_sql implements renderable { $this->define_baseurl($url); // Do some business - then set the sql. - $currentgroup = groups_get_activity_group($assignment->get_course_module(), true); + $currentgroup = groups_get_activity_group($assignment->get_course_module(), true, participationonly: false); if ($rowoffset) { $this->rownum = $rowoffset - 1; diff --git a/public/mod/assign/tests/behat/group_submission.feature b/public/mod/assign/tests/behat/group_submission.feature index c1f5855af1e..83c24f01380 100644 --- a/public/mod/assign/tests/behat/group_submission.feature +++ b/public/mod/assign/tests/behat/group_submission.feature @@ -369,7 +369,7 @@ Feature: Group assignment submissions And I should see "Submitted for grading" in the "Submission status" "table_row" And I should not see "Users who need to submit" - Scenario: Group submission does not use non-participation groups + Scenario: Students cannot make a group submission under a non-participation group Given the following "groups" exist: | name | course | idnumber | participation | | Group A | C1 | CG1 | 0 | @@ -386,3 +386,39 @@ Feature: Group assignment submissions When I am on the "Test assignment name" Activity page logged in as student1 Then I should see "Default group" And I should not see "Group A" + + @javascript + Scenario: All groups including non-participation groups can be used for filtering submissions + Given the following "groups" exist: + | name | course | idnumber | participation | visibility | + | Group 2 | C1 | G2 | 0 | 0 | + | Group 3 | C1 | G3 | 0 | 3 | + And the following "group members" exist: + | group | user | + | G1 | student1 | + | G2 | student1 | + | G1 | student2 | + | G2 | student3 | + And the following "activity" exists: + | activity | assign | + | course | C1 | + | name | Test assignment name | + | submissiondrafts | 0 | + | teamsubmission | 1 | + | groupmode | 1 | + And the following "mod_assign > submissions" exist: + | assign | user | onlinetext | + | Test assignment name | student1 | I'm the student's first submission | + | Test assignment name | student3 | I'm the student's first submission | + When I am on the "Test assignment name" Activity page logged in as teacher1 + And I follow "Submissions" + And I confirm "Group 1" exists in the "Search groups" search combo box + And I confirm "Group 2" exists in the "Search groups" search combo box + And I confirm "Group 3" exists in the "Search groups" search combo box + And I should not see "Non-participation" in the "Group 1" "list_item" + And I should see "Non-participation" in the "Group 2" "list_item" + And I should see "Non-participation" in the "Group 3" "list_item" + And I click on "Group 2" in the "Search groups" search combo box + Then I should see "Student 1" + And I should see "Student 3" + And I should not see "Student 2"