protected function process_add_attempt_group($useridlist) {
        $groupsprocessed = array();
        $result = true;

        foreach ($useridlist as $userid) {
            $groupid = 0;
            $group = $this->get_submission_group($userid);
            if ($group) {
                $groupid = $group->id;
            }

            if (empty($groupsprocessed[$groupid])) {
                // We need to know what the most recent group submission is.
                // Specifically when determining if we are adding another attempt (we only want to add one attempt per team),
                // and when deciding if we need to update the gradebook with an edited grade.
                $currentsubmission = $this->get_group_submission($userid, 0, false, -1);
                $this->set_most_recent_team_submission($currentsubmission);
                $result = $this->process_add_attempt($userid) && $result;
                $groupsprocessed[$groupid] = true;
            }
        }
        return $result;
    }
protected function process_add_attempt_group($useridlist) {
        $groupsprocessed = array();
        $result = true;

        foreach ($useridlist as $userid) {
            $groupid = 0;
            $group = $this->get_submission_group($userid);
            if ($group) {
                $groupid = $group->id;
            }

            if (empty($groupsprocessed[$groupid])) {
                // We need to know what the most recent group submission is.
                // Specifically when determining if we are adding another attempt (we only want to add one attempt per team),
                // and when deciding if we need to update the gradebook with an edited grade.
                $currentsubmission = $this->get_group_submission($userid, 0, false, -1);
                $this->set_most_recent_team_submission($currentsubmission);
                $result = $this->process_add_attempt($userid) && $result;
                $groupsprocessed[$groupid] = true;
            }
        }
        return $result;
    }
protected function process_add_attempt_group ( $ useridlist ) { $ groupsprocessed = array ( ) ; $ result = true ; foreach ( $ useridlist as $ userid ) { $ groupid = 0 ; $ group = $ this -> get_submission_group ( $ userid ) ; if ( $ group ) { $ groupid = $ group -> id ; } if ( empty ( $ groupsprocessed [ $ groupid ] ) ) { // We need to know what the most recent group submission is. // Specifically when determining if we are adding another attempt (we only want to add one attempt per team), // and when deciding if we need to update the gradebook with an edited grade. $ currentsubmission = $ this -> get_group_submission ( $ userid , 0 , false , - 1 ) ; $ this -> set_most_recent_team_submission ( $ currentsubmission ) ; $ result = $ this -> process_add_attempt ( $ userid ) && $ result ; $ groupsprocessed [ $ groupid ] = true ; } } return $ result ; }
Add a new attempt for each user in the list - but reopen each group assignment
at most 1 time.

@param array $useridlist Array of userids to reopen.
@return bool
Add a new attempt for each user in the list - but reopen each group assignment at most 1 time .