-
Bug
-
Resolution: Fixed
-
Minor
-
3.10.4, 3.11.1, 4.0
-
MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_310_STABLE, MOODLE_311_STABLE
-
Bug reported by mohalisad in MDL-67249 comments.
When you run model evaluation script from CLI and the model is disabled it should interactively enables your model.
But it has a bug and an exception occurs in process:
!!! Exception - Call to a member function based_on_assumptions() on bool !!!
|
It happens in here (analytics/classes/model.php: line 1204):
The get_target method returns false and that causes this exception.
This problem is due to the fact that in evaluate_model.php cli file we have an undefined variable(admin/tool/analytics/cli/evaluate_model.php):
The $modelobj is never referenced before this line therefore the $model constructed wrongly in line 140 and in line 143 that causes an exception.
Stacktrace:
Steps to reproduce:
- Go to Analytics model page and choose a model than could be evaluated e.g. 'Students at risk of dropping out'. Remember the id of the model and disable it.
- Run 'php admin/tool/analytics/cli/evaluate_model.php --modelid=xx' using modelid of the previous model.
- Use a valid subclass of '\core_analytics\local\time_splitting\base' as an analysis interval. e.g. '\core\analytics\time_splitting\single_range'
- Script should finish with no error