protected function get_num_competencies_in_course ($courseid) {

        if (!isset($this->coursecompetencies[$courseid])) {
            $ccs = \core_competency\api::count_competencies_in_course($courseid);
            // Save the number of competencies per course to avoid another database access in calculate_sample().
            $this->coursecompetencies[$courseid] = $ccs;
        } else {
            $ccs = $this->coursecompetencies[$courseid];
        }
        return $ccs;
    }
protected function get_num_competencies_in_course ($courseid) {

        if (!isset($this->coursecompetencies[$courseid])) {
            $ccs = \core_competency\api::count_competencies_in_course($courseid);
            // Save the number of competencies per course to avoid another database access in calculate_sample().
            $this->coursecompetencies[$courseid] = $ccs;
        } else {
            $ccs = $this->coursecompetencies[$courseid];
        }
        return $ccs;
    }
protected function get_num_competencies_in_course ( $ courseid ) { if ( ! isset ( $ this -> coursecompetencies [ $ courseid ] ) ) { $ ccs = \ core_competency \ api :: count_competencies_in_course ( $ courseid ) ; // Save the number of competencies per course to avoid another database access in calculate_sample(). $ this -> coursecompetencies [ $ courseid ] = $ ccs ; } else { $ ccs = $ this -> coursecompetencies [ $ courseid ] ; } return $ ccs ; }
Count the competencies in a course.

Save the value in $coursecompetencies array to prevent new accesses to the database.

@param int $courseid The course id.
@return int Number of competencies assigned to the course.
Count the competencies in a course .