MDL-64996 analytics: Make sure the no_teaching model is trained

Due to the bug, the no_teaching model might have been marked as
not-trained in the database. Static predictions models (i.e. those using
a target based on assumptions, not facts) are always considered as
trained. If they were marked as not-trained, the prediction scheduled
task would skip them and they would produce no predictions.

Ideally, such a fix should be done for all static models. But there is
no easy way to do it during the upgrade where accessing the analytics
API is not possible. I don't think there are many models out there that
would be affected by this so this seems to be good enough solution for
now (and the future ability to reset models will cover the rest).
This commit is contained in:
David Mudrák
2019-03-25 09:16:13 +01:00
parent 8e2360f9c8
commit 959c70e87b
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -2462,5 +2462,11 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2018051705.01);
}
if ($oldversion < 2018051705.04) {
// The no_teaching model might have been marked as not-trained by mistake (static models are always trained).
$DB->set_field('analytics_models', 'trained', 1, ['target' => '\core\analytics\target\no_teaching']);
upgrade_main_savepoint(true, 2018051705.04);
}
return true;
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2018051705.03; // 20180517 = branching date YYYYMMDD - do not modify!
$version = 2018051705.04; // 20180517 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.