original_string: protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
  
          $userenrol = $this->retrieve('user_enrolments', $sampleid);
  
          // We use completion as a success metric.
          $ccompletion = new \completion_completion(array('userid' => $userenrol->userid, 'course' => $course->get_id()));
          if ($ccompletion->is_complete()) {
              return 0;
          } else {
              return 1;
          }
      }
code: protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
  
          $userenrol = $this->retrieve('user_enrolments', $sampleid);
  
          // We use completion as a success metric.
          $ccompletion = new \completion_completion(array('userid' => $userenrol->userid, 'course' => $course->get_id()));
          if ($ccompletion->is_complete()) {
              return 0;
          } else {
              return 1;
          }
      }
code_tokens: protected function calculate_sample ( $ sampleid , \ core_analytics \ analysable $ course , $ starttime = false , $ endtime = false ) { $ userenrol = $ this -> retrieve ( 'user_enrolments' , $ sampleid ) ; // We use completion as a success metric. $ ccompletion = new \ completion_completion ( array ( 'userid' => $ userenrol -> userid , 'course' => $ course -> get_id ( ) ) ) ; if ( $ ccompletion -> is_complete ( ) ) { return 0 ; } else { return 1 ; } }
docstring: Course completion sets the target value.
  
  @param int $sampleid
  @param \core_analytics\analysable $course
  @param int $starttime
  @param int $endtime
  @return float 0 -> course not completed, 1 -> course completed
docstring_tokens: Course completion sets the target value .