original_string: protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
  
          $userenrol = $this->retrieve('user_enrolments', $sampleid);
  
          $key = $course->get_id();
          // Number of competencies in the course.
          $ccs = $this->get_num_competencies_in_course($key);
          // Number of proficient competencies in the same course for the user.
          $ucs = \core_competency\api::count_proficient_competencies_in_course_for_user($key, $userenrol->userid);
  
          // If they are the equals, the user achieved all the competencies assigned to the course.
          if ($ccs == $ucs) {
              return 0;
          }
  
          return 1;
      }
code: protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
  
          $userenrol = $this->retrieve('user_enrolments', $sampleid);
  
          $key = $course->get_id();
          // Number of competencies in the course.
          $ccs = $this->get_num_competencies_in_course($key);
          // Number of proficient competencies in the same course for the user.
          $ucs = \core_competency\api::count_proficient_competencies_in_course_for_user($key, $userenrol->userid);
  
          // If they are the equals, the user achieved all the competencies assigned to the course.
          if ($ccs == $ucs) {
              return 0;
          }
  
          return 1;
      }
code_tokens: protected function calculate_sample ( $ sampleid , \ core_analytics \ analysable $ course , $ starttime = false , $ endtime = false ) { $ userenrol = $ this -> retrieve ( 'user_enrolments' , $ sampleid ) ; $ key = $ course -> get_id ( ) ; // Number of competencies in the course. $ ccs = $ this -> get_num_competencies_in_course ( $ key ) ; // Number of proficient competencies in the same course for the user. $ ucs = \ core_competency \ api :: count_proficient_competencies_in_course_for_user ( $ key , $ userenrol -> userid ) ; // If they are the equals, the user achieved all the competencies assigned to the course. if ( $ ccs == $ ucs ) { return 0 ; } return 1 ; }
docstring: To have the proficiency or not in each of the competencies assigned to the course sets the target value.
  
  @param int $sampleid
  @param \core_analytics\analysable $course
  @param int $starttime
  @param int $endtime
  @return float 0 -> competencies achieved, 1 -> competencies not achieved
docstring_tokens: To have the proficiency or not in each of the competencies assigned to the course sets the target value .