mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'MDL-59774_master' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
104ae3efdf
@ -84,15 +84,9 @@ class manager {
|
||||
|
||||
$params = array();
|
||||
|
||||
$fields = 'am.id, am.enabled, am.trained, am.target, ' . $DB->sql_compare_text('am.indicators') .
|
||||
', am.timesplitting, am.version, am.timecreated, am.timemodified, am.usermodified';
|
||||
$sql = "SELECT DISTINCT $fields FROM {analytics_models} am";
|
||||
if ($predictioncontext) {
|
||||
$sql .= " JOIN {analytics_predictions} ap ON ap.modelid = am.id AND ap.contextid = :contextid";
|
||||
$params['contextid'] = $predictioncontext->id;
|
||||
}
|
||||
$sql = "SELECT am.* FROM {analytics_models} am";
|
||||
|
||||
if ($enabled || $trained) {
|
||||
if ($enabled || $trained || $predictioncontext) {
|
||||
$conditions = [];
|
||||
if ($enabled) {
|
||||
$conditions[] = 'am.enabled = :enabled';
|
||||
@ -102,6 +96,10 @@ class manager {
|
||||
$conditions[] = 'am.trained = :trained';
|
||||
$params['trained'] = 1;
|
||||
}
|
||||
if ($predictioncontext) {
|
||||
$conditions[] = "EXISTS (SELECT 'x' FROM {analytics_predictions} ap WHERE ap.modelid = am.id AND ap.contextid = :contextid)";
|
||||
$params['contextid'] = $predictioncontext->id;
|
||||
}
|
||||
$sql .= ' WHERE ' . implode(' AND ', $conditions);
|
||||
}
|
||||
$sql .= ' ORDER BY am.enabled DESC, am.timemodified DESC';
|
||||
|
Loading…
x
Reference in New Issue
Block a user