original_string: public function is_valid_sample($sampleid, \core_analytics\analysable $analysable, $fortraining = true) {
  
          $course = $this->retrieve('course', $sampleid);
  
          $now = time();
  
          // No courses without start date, no finished courses, no predictions before start - 1 week nor
          // predictions for courses that started more than 1 week ago.
          if (!$course->startdate || (!empty($course->enddate) && $course->enddate < $now) ||
                  $course->startdate - WEEKSECS > $now || $course->startdate + WEEKSECS < $now) {
              return false;
          }
          return true;
      }
code: public function is_valid_sample($sampleid, \core_analytics\analysable $analysable, $fortraining = true) {
  
          $course = $this->retrieve('course', $sampleid);
  
          $now = time();
  
          // No courses without start date, no finished courses, no predictions before start - 1 week nor
          // predictions for courses that started more than 1 week ago.
          if (!$course->startdate || (!empty($course->enddate) && $course->enddate < $now) ||
                  $course->startdate - WEEKSECS > $now || $course->startdate + WEEKSECS < $now) {
              return false;
          }
          return true;
      }
code_tokens: public function is_valid_sample ( $ sampleid , \ core_analytics \ analysable $ analysable , $ fortraining = true ) { $ course = $ this -> retrieve ( 'course' , $ sampleid ) ; $ now = time ( ) ; // No courses without start date, no finished courses, no predictions before start - 1 week nor // predictions for courses that started more than 1 week ago. if ( ! $ course -> startdate || ( ! empty ( $ course -> enddate ) && $ course -> enddate < $ now ) || $ course -> startdate - WEEKSECS > $ now || $ course -> startdate + WEEKSECS < $ now ) { return false ; } return true ; }
docstring: Only process samples which start date is getting close.
  
  @param int $sampleid
  @param \core_analytics\analysable $analysable
  @param bool $fortraining
  @return bool
docstring_tokens: Only process samples which start date is getting close .