original_string: protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
  
          $userenrol = $this->retrieve('user_enrolments', $sampleid);
  
          // Get course grade to pass.
          $courseitem = $this->get_course_gradetopass($course->get_id());
  
          // Get the user grade.
          $usergrade = $this->get_user_grade($courseitem['courseitemid'], $userenrol->userid);
  
          if ($usergrade >= $courseitem['gradetopass']) {
              return 0;
          }
  
          return 1;
      }
code: protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
  
          $userenrol = $this->retrieve('user_enrolments', $sampleid);
  
          // Get course grade to pass.
          $courseitem = $this->get_course_gradetopass($course->get_id());
  
          // Get the user grade.
          $usergrade = $this->get_user_grade($courseitem['courseitemid'], $userenrol->userid);
  
          if ($usergrade >= $courseitem['gradetopass']) {
              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 ) ; // Get course grade to pass. $ courseitem = $ this -> get_course_gradetopass ( $ course -> get_id ( ) ) ; // Get the user grade. $ usergrade = $ this -> get_user_grade ( $ courseitem [ 'courseitemid' ] , $ userenrol -> userid ) ; if ( $ usergrade >= $ courseitem [ 'gradetopass' ] ) { return 0 ; } return 1 ; }
docstring: The user's grade in the course sets the target value.
  
  @param int $sampleid
  @param \core_analytics\analysable $course
  @param int $starttime
  @param int $endtime
  @return float 0 -> course grade to pass achieved, 1 -> course grade to pass not achieved
docstring_tokens: The user s grade in the course sets the target value .