MDL-65839 core_analytics: New indicator instances for each analysable
This commit is contained in:
@@ -594,7 +594,9 @@ abstract class base {
|
||||
}
|
||||
|
||||
try {
|
||||
foreach ($this->indicators as $key => $indicator) {
|
||||
|
||||
// Instantiate empty indicators to ensure that no garbage is dragged from previous analyses.
|
||||
foreach ($this->instantiate_indicators() as $key => $indicator) {
|
||||
// The analyser attaches the main entities the sample depends on and are provided to the
|
||||
// indicator to calculate the sample.
|
||||
$this->indicators[$key]->add_sample_data($samplesdata);
|
||||
@@ -651,6 +653,18 @@ abstract class base {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the indicators.
|
||||
*
|
||||
* @return \core_analytics\local\indicator\base[]
|
||||
*/
|
||||
public function instantiate_indicators() {
|
||||
foreach ($this->indicators as $key => $indicator) {
|
||||
$this->indicators[$key] = call_user_func(array($indicator, 'instance'));
|
||||
}
|
||||
return $this->indicators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most recent range that can be used to predict.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user