diff --git a/mod/assign/classes/notification_helper.php b/mod/assign/classes/notification_helper.php index 23fcd024345..1b2770dc7eb 100644 --- a/mod/assign/classes/notification_helper.php +++ b/mod/assign/classes/notification_helper.php @@ -227,7 +227,7 @@ class notification_helper { $assignmentobj = self::get_assignment_data($assignmentid); // Get our assignment users. - $users = $assignmentobj->list_participants(0, true); + $users = $assignmentobj->list_participants(0, true, false, true); foreach ($users as $key => $user) { // Check if the user has submitted already. diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 8715f232c74..545100bbe58 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -2272,8 +2272,9 @@ class assign { * @param bool $idsonly * @param bool $tablesort * @return array List of user records + * @param bool|null $onlyactive Whether to show only active users. */ - public function list_participants($currentgroup, $idsonly, $tablesort = false) { + public function list_participants($currentgroup, $idsonly, $tablesort = false, ?bool $onlyactive = null) { global $DB, $USER; // Get the last known sort order for the grading table. @@ -2282,10 +2283,13 @@ class assign { $currentgroup = 0; } - $key = $this->context->id . '-' . $currentgroup . '-' . $this->show_only_active_users(); + if ($onlyactive === null) { + $onlyactive = $this->show_only_active_users(); + } + + $key = $this->context->id . '-' . $currentgroup . '-' . $onlyactive; if (!isset($this->participants[$key])) { - list($esql, $params) = get_enrolled_sql($this->context, 'mod/assign:submit', $currentgroup, - $this->show_only_active_users()); + list($esql, $params) = get_enrolled_sql($this->context, 'mod/assign:submit', $currentgroup, $onlyactive); list($ssql, $sparams) = $this->get_submitted_sql($currentgroup); $params += $sparams;