* This means the submission modification time is more recent than the
* grading modification time and the status is SUBMITTED.
*
+ * @param mixed $currentgroup int|null the group for counting (if null the function will determine it)
* @return int number of matching submissions
*/
- public function count_submissions_need_grading() {
+ public function count_submissions_need_grading($currentgroup = null) {
global $DB;
if ($this->get_instance()->teamsubmission) {
return 0;
}
- $currentgroup = groups_get_activity_group($this->get_course_module(), true);
+ if ($currentgroup === null) {
+ $currentgroup = groups_get_activity_group($this->get_course_module(), true);
+ }
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
$params['assignid'] = $this->get_instance()->id;
* Load a count of submissions with a specified status.
*
* @param string $status The submission status - should match one of the constants
+ * @param mixed $currentgroup int|null the group for counting (if null the function will determine it)
* @return int number of matching submissions
*/
- public function count_submissions_with_status($status) {
+ public function count_submissions_with_status($status, $currentgroup = null) {
global $DB;
- $currentgroup = groups_get_activity_group($this->get_course_module(), true);
+ if ($currentgroup === null) {
+ $currentgroup = groups_get_activity_group($this->get_course_module(), true);
+ }
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
$params['assignid'] = $this->get_instance()->id;
$summary = new assign_grading_summary($this->count_teams($activitygroup),
$instance->submissiondrafts,
- $this->count_submissions_with_status($draft),
+ $this->count_submissions_with_status($draft, $activitygroup),
$this->is_any_submission_plugin_enabled(),
- $this->count_submissions_with_status($submitted),
+ $this->count_submissions_with_status($submitted, $activitygroup),
$instance->cutoffdate,
$instance->duedate,
$this->get_course_module()->id,
- $this->count_submissions_need_grading(),
+ $this->count_submissions_need_grading($activitygroup),
$instance->teamsubmission,
$warnofungroupedusers,
$this->can_grade());
$countparticipants = $this->count_participants($activitygroup);
$summary = new assign_grading_summary($countparticipants,
$instance->submissiondrafts,
- $this->count_submissions_with_status($draft),
+ $this->count_submissions_with_status($draft, $activitygroup),
$this->is_any_submission_plugin_enabled(),
- $this->count_submissions_with_status($submitted),
+ $this->count_submissions_with_status($submitted, $activitygroup),
$instance->cutoffdate,
$instance->duedate,
$this->get_course_module()->id,
- $this->count_submissions_need_grading(),
+ $this->count_submissions_need_grading($activitygroup),
$instance->teamsubmission,
false,
$this->can_grade());