$count += 1;
}
}
+ } else if ($activitygroup != 0 && empty($groups)) {
+ // Set count to 1 if $groups returns empty.
+ // It means the group is not part of $this->get_instance()->teamsubmissiongroupingid.
+ $count = 1;
}
} else {
// It is faster to loop around participants if no grouping was specified.
array_keys($participants),
$this->get_instance()->teamsubmissiongroupingid,
'DISTINCT g.id, g.name');
+ if (empty($groups)) {
+ // If $groups is empty it means it is not part of $this->get_instance()->teamsubmissiongroupingid.
+ // All submissions from students that do not belong to any of teamsubmissiongroupingid groups
+ // count towards groupid = 0. Setting to true as only '0' key matters.
+ $groups = [true];
+ }
list($groupssql, $groupsparams) = $DB->get_in_or_equal(array_keys($groups), SQL_PARAMS_NAMED);
$groupsstr = 's.groupid ' . $groupssql . ' AND';
$params = $params + $groupsparams;