Skip to content

Commit

Permalink
MDL-64996 analytics: Make sure the no_teaching model is trained
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
mudrd8mz committed Mar 25, 2019
1 parent c679d39 commit b29cfc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -2917,5 +2917,11 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019031500.01);
}

if ($oldversion < 2019032200.01) {
// 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, 2019032200.01);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2019032200.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019032200.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit b29cfc5

Please sign in to comment.