// Default to all system courses.
if (!empty($this->options['filter'])) {
- $courses = $this->options['filter'];
+ $courses = array();
+ foreach ($this->options['filter'] as $courseid) {
+ $courses[$courseid] = new \stdClass();
+ $courses[$courseid]->id = $courseid;
+ }
} else {
// Iterate through all potentially valid courses.
$courses = get_courses('all', 'c.sortorder ASC', 'c.id');
$dataset = $this->calculate_indicators($sampleids, $samplesorigin, $indicators, $ranges);
+ if (empty($dataset)) {
+ return false;
+ }
+
// Now that we have the indicators in place we can add the time range indicators (and target if provided) to each of them.
$this->fill_dataset($dataset, $calculatedtarget);