original_string: public static function count_proficient_competencies($courseid, $userid) {
          global $DB;
  
          $sql = 'SELECT COUNT(comp.id)
                    FROM {' . self::TABLE . '} usercoursecomp
                    JOIN {' . course_competency::TABLE . '} cc
                      ON usercoursecomp.competencyid = cc.competencyid AND cc.courseid = usercoursecomp.courseid
                    JOIN {' . competency::TABLE . '} comp
                      ON usercoursecomp.competencyid = comp.id
                   WHERE usercoursecomp.courseid = ? AND usercoursecomp.userid = ? AND usercoursecomp.proficiency = ?';
          $params = array($courseid, $userid, true);
  
          $results = $DB->count_records_sql($sql, $params);
  
          return $results;
      }
code: public static function count_proficient_competencies($courseid, $userid) {
          global $DB;
  
          $sql = 'SELECT COUNT(comp.id)
                    FROM {' . self::TABLE . '} usercoursecomp
                    JOIN {' . course_competency::TABLE . '} cc
                      ON usercoursecomp.competencyid = cc.competencyid AND cc.courseid = usercoursecomp.courseid
                    JOIN {' . competency::TABLE . '} comp
                      ON usercoursecomp.competencyid = comp.id
                   WHERE usercoursecomp.courseid = ? AND usercoursecomp.userid = ? AND usercoursecomp.proficiency = ?';
          $params = array($courseid, $userid, true);
  
          $results = $DB->count_records_sql($sql, $params);
  
          return $results;
      }
code_tokens: public static function count_proficient_competencies ( $ courseid , $ userid ) { global $ DB ; $ sql = 'SELECT COUNT(comp.id)
                    FROM {' . self :: TABLE . '} usercoursecomp
                    JOIN {' . course_competency :: TABLE . '} cc
                      ON usercoursecomp.competencyid = cc.competencyid AND cc.courseid = usercoursecomp.courseid
                    JOIN {' . competency :: TABLE . '} comp
                      ON usercoursecomp.competencyid = comp.id
                   WHERE usercoursecomp.courseid = ? AND usercoursecomp.userid = ? AND usercoursecomp.proficiency = ?' ; $ params = array ( $ courseid , $ userid , true ) ; $ results = $ DB -> count_records_sql ( $ sql , $ params ) ; return $ results ; }
docstring: Count the proficient competencies in this course for one user.
  
  @param int $courseid The course id
  @param int $userid The user id
  @return int
docstring_tokens: Count the proficient competencies in this course for one user .