original_string: protected function prepare_prediction_record($sampleid, $rangeindex, $prediction, $predictionscore, $calculations) {
          $context = $this->get_analyser()->sample_access_context($sampleid);
  
          $record = new \stdClass();
          $record->modelid = $this->model->id;
          $record->contextid = $context->id;
          $record->sampleid = $sampleid;
          $record->rangeindex = $rangeindex;
          $record->prediction = $prediction;
          $record->predictionscore = $predictionscore;
          $record->calculations = $calculations;
          $record->timecreated = time();
  
          $analysable = $this->get_analyser()->get_sample_analysable($sampleid);
          $timesplitting = $this->get_time_splitting();
          $timesplitting->set_analysable($analysable);
          $range = $timesplitting->get_range_by_index($rangeindex);
          if ($range) {
              $record->timestart = $range['start'];
              $record->timeend = $range['end'];
          }
  
          return array($record, $context);
      }
code: protected function prepare_prediction_record($sampleid, $rangeindex, $prediction, $predictionscore, $calculations) {
          $context = $this->get_analyser()->sample_access_context($sampleid);
  
          $record = new \stdClass();
          $record->modelid = $this->model->id;
          $record->contextid = $context->id;
          $record->sampleid = $sampleid;
          $record->rangeindex = $rangeindex;
          $record->prediction = $prediction;
          $record->predictionscore = $predictionscore;
          $record->calculations = $calculations;
          $record->timecreated = time();
  
          $analysable = $this->get_analyser()->get_sample_analysable($sampleid);
          $timesplitting = $this->get_time_splitting();
          $timesplitting->set_analysable($analysable);
          $range = $timesplitting->get_range_by_index($rangeindex);
          if ($range) {
              $record->timestart = $range['start'];
              $record->timeend = $range['end'];
          }
  
          return array($record, $context);
      }
code_tokens: protected function prepare_prediction_record ( $ sampleid , $ rangeindex , $ prediction , $ predictionscore , $ calculations ) { $ context = $ this -> get_analyser ( ) -> sample_access_context ( $ sampleid ) ; $ record = new \ stdClass ( ) ; $ record -> modelid = $ this -> model -> id ; $ record -> contextid = $ context -> id ; $ record -> sampleid = $ sampleid ; $ record -> rangeindex = $ rangeindex ; $ record -> prediction = $ prediction ; $ record -> predictionscore = $ predictionscore ; $ record -> calculations = $ calculations ; $ record -> timecreated = time ( ) ; $ analysable = $ this -> get_analyser ( ) -> get_sample_analysable ( $ sampleid ) ; $ timesplitting = $ this -> get_time_splitting ( ) ; $ timesplitting -> set_analysable ( $ analysable ) ; $ range = $ timesplitting -> get_range_by_index ( $ rangeindex ) ; if ( $ range ) { $ record -> timestart = $ range [ 'start' ] ; $ record -> timeend = $ range [ 'end' ] ; } return array ( $ record , $ context ) ; }
docstring: Stores the prediction in the database.
  
  @param int $sampleid
  @param int $rangeindex
  @param int $prediction
  @param float $predictionscore
  @param string $calculations
  @return \context
docstring_tokens: Stores the prediction in the database .