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;
        }
    }
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;
        }
    }
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 ; } }
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
Course completion sets the target value .