MDL-65633 tool_analytics: Notification for invalid analysis intervals

This commit is contained in:
David Monllaó
2019-07-18 18:38:13 +02:00
parent 3cb0aaaa8c
commit 5ef49c591a
10 changed files with 135 additions and 39 deletions
+20
View File
@@ -1799,6 +1799,26 @@ class model {
has_capability('moodle/analytics:managemodels', \context_system::instance()), $displayname, $this->model->name);
}
/**
* Returns true if the time-splitting method used by this model is invalid for this model.
* @return bool
*/
public function invalid_timesplitting_selected(): bool {
$currenttimesplitting = $this->model->timesplitting;
if (empty($currenttimesplitting)) {
// Not set is different from invalid. This function is used to identify invalid
// time-splittings.
return false;
}
$potentialtimesplittings = $this->get_potential_timesplittings();
if ($currenttimesplitting && empty($potentialtimesplittings[$currenttimesplitting])) {
return true;
}
return false;
}
/**
* Adds the id from {analytics_predictions} db table to the prediction \stdClass objects.
*