Skip to content

Commit

Permalink
Merge branch 'MDL-66210_master' of git://github.com/dmonllao/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Aug 21, 2019
2 parents 2b29298 + 2bbe76b commit 7c50f31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions analytics/classes/local/analysis/result_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public function retrieve_cached_result(\core_analytics\local\time_splitting\base
// if this analyser was analysed less that 1 week ago we skip generating a new one. This
// helps scale the evaluation process as sites with tons of courses may need a lot of time to
// complete an evaluation.
if (!empty($options['evaluation']) && !empty($options['reuseprevanalysed'])) {
if (!empty($this->options['evaluation']) && !empty($this->options['reuseprevanalysed'])) {

$previousanalysis = \core_analytics\dataset_manager::get_evaluation_analysable_file($this->analyser->get_modelid(),
$previousanalysis = \core_analytics\dataset_manager::get_evaluation_analysable_file($this->modelid,
$analysable->get_id(), $timesplitting->get_id());
// 1 week is a partly random time interval, no need to worry about DST.
$boundary = time() - WEEKSECS;
Expand Down
7 changes: 7 additions & 0 deletions analytics/tests/prediction_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,13 @@ public function test_ml_evaluation_configuration($modelquality, $ncourses, $expe
$message = 'The returned status code ' . $result->status . ' should include ' . $expected[$timesplitting];
$filtered = $result->status & $expected[$timesplitting];
$this->assertEquals($expected[$timesplitting], $filtered, $message);

$options = ['evaluation' => true, 'reuseprevanalysed' => true];
$result = new \core_analytics\local\analysis\result_file($model->get_id(), true, $options);
$timesplittingobj = \core_analytics\manager::get_time_splitting($timesplitting);
$analysable = new \core_analytics\site();
$cachedanalysis = $result->retrieve_cached_result($timesplittingobj, $analysable);
$this->assertInstanceOf(\stored_file::class, $cachedanalysis);
}

set_config('enabled_stores', '', 'tool_log');
Expand Down

0 comments on commit 7c50f31

Please sign in to comment.