Merge branch 'MDL-63906_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Jun Pataleta 2019-04-01 10:32:10 +08:00
commit db3527c2cc

View File

@ -577,9 +577,14 @@ abstract class base {
return $result;
}
try {
// Remove samples the target consider invalid.
$this->analysabletarget->add_sample_data($samplesdata);
$this->analysabletarget->filter_out_invalid_samples($sampleids, $analysable, $includetarget);
} catch (\Throwable $e) {
$dataset->close_process();
throw $e;
}
if (!$sampleids) {
$result->status = \core_analytics\model::NO_DATASET;
@ -588,6 +593,7 @@ abstract class base {
return $result;
}
try {
foreach ($this->indicators as $key => $indicator) {
// The analyser attaches the main entities the sample depends on and are provided to the
// indicator to calculate the sample.
@ -602,6 +608,10 @@ abstract class base {
} else {
$data = $timesplitting->calculate($sampleids, $this->get_samples_origin(), $this->indicators, $ranges);
}
} catch (\Throwable $e) {
$dataset->close_process();
throw $e;
}
if (!$data) {
$result->status = \core_analytics\model::ANALYSABLE_REJECTED_TIME_SPLITTING_METHOD;
@ -610,11 +620,16 @@ abstract class base {
return $result;
}
try {
// Add extra metadata.
$this->add_model_metadata($data);
// Write all calculated data to a file.
$file = $dataset->store($data);
} catch (\Throwable $e) {
$dataset->close_process();
throw $e;
}
// Flag the model + analysable + timesplitting as analysed.
$dataset->close_process();