From cb45079282eb5f60784021145247dbb206d18baf 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. --- mod/assign/gradingtable.php | 2 +- mod/assign/locallib.php | 2 +- .../tests/behat/group_submission.feature | 31 ++++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/mod/assign/gradingtable.php b/mod/assign/gradingtable.php index bbb0af951d4a6..1c0581ae9bd31 100644 --- a/mod/assign/gradingtable.php +++ b/mod/assign/gradingtable.php @@ -118,7 +118,7 @@ public function __construct(assign $assignment, $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/mod/assign/locallib.php b/mod/assign/locallib.php index 2dd38509487ec..1e38cb2c104c2 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4585,7 +4585,7 @@ protected function view_grading_table() { $o .= $this->get_renderer()->heading(get_string('gradeitem:submissions', 'mod_assign'), 2); $o .= $this->get_renderer()->render($gradingactions); - $o .= groups_print_activity_menu($this->get_course_module(), $currenturl, true); + $o .= groups_print_activity_menu($this->get_course_module(), $currenturl, true, participationonly: false); // Plagiarism update status apearring in the grading book. if (!empty($CFG->enableplagiarism)) { diff --git a/mod/assign/tests/behat/group_submission.feature b/mod/assign/tests/behat/group_submission.feature index f635e78db93fd..669cd03e39aac 100644 --- a/mod/assign/tests/behat/group_submission.feature +++ b/mod/assign/tests/behat/group_submission.feature @@ -326,7 +326,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 | @@ -343,3 +343,32 @@ 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 | + | Group 2 | C1 | G2 | 0 | + 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 "View all submissions" + And I set the field "Separate groups" to "Group 2" + Then I should see "Student 1" + And I should see "Student 3" + And I should not see "Student 2"