public function get_assign_grading_summary_renderable($activitygroup = null) {

        $instance = $this->get_instance();
        $cm = $this->get_course_module();

        $draft = ASSIGN_SUBMISSION_STATUS_DRAFT;
        $submitted = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
        $isvisible = $cm->visible;

        if ($activitygroup === null) {
            $activitygroup = groups_get_activity_group($cm);
        }

        if ($instance->teamsubmission) {
            $defaultteammembers = $this->get_submission_group_members(0, true);
            $warnofungroupedusers = (count($defaultteammembers) > 0 && $instance->preventsubmissionnotingroup);

            $summary = new assign_grading_summary($this->count_teams($activitygroup),
                                                  $instance->submissiondrafts,
                                                  $this->count_submissions_with_status($draft, $activitygroup),
                                                  $this->is_any_submission_plugin_enabled(),
                                                  $this->count_submissions_with_status($submitted, $activitygroup),
                                                  $instance->cutoffdate,
                                                  $instance->duedate,
                                                  $this->get_course_module()->id,
                                                  $this->count_submissions_need_grading($activitygroup),
                                                  $instance->teamsubmission,
                                                  $warnofungroupedusers,
                                                  $this->can_grade(),
                                                  $isvisible);
        } else {
            // The active group has already been updated in groups_print_activity_menu().
            $countparticipants = $this->count_participants($activitygroup);
            $summary = new assign_grading_summary($countparticipants,
                                                  $instance->submissiondrafts,
                                                  $this->count_submissions_with_status($draft, $activitygroup),
                                                  $this->is_any_submission_plugin_enabled(),
                                                  $this->count_submissions_with_status($submitted, $activitygroup),
                                                  $instance->cutoffdate,
                                                  $instance->duedate,
                                                  $this->get_course_module()->id,
                                                  $this->count_submissions_need_grading($activitygroup),
                                                  $instance->teamsubmission,
                                                  false,
                                                  $this->can_grade(),
                                                  $isvisible);
        }

        return $summary;
    }