Commit b1869131 authored by Adrian Greeve's avatar Adrian Greeve
Browse files

Merge branch 'MDL-60936_master' of git://github.com/dmonllao/moodle

parents d08e28a3 3576b66b
......@@ -83,8 +83,9 @@ if ($hassiteconfig) {
foreach ($alltimesplittings as $key => $timesplitting) {
$timesplittingoptions[$key] = $timesplitting->get_name();
}
$settings->add(new admin_setting_configmultiselect('analytics/timesplittings',
new lang_string('enabledtimesplittings', 'analytics'), new lang_string('timesplittingmethod_help', 'analytics'),
$settings->add(new admin_setting_configmultiselect('analytics/defaulttimesplittingsevaluation',
new lang_string('defaulttimesplittingmethods', 'analytics'),
new lang_string('defaulttimesplittingmethods_help', 'analytics'),
$timesplittingdefaults, $timesplittingoptions)
);
......
......@@ -68,8 +68,8 @@ $string['evaluationmodeconfiguration'] = 'Evaluate the model configuration';
$string['evaluationinbatches'] = 'The site contents are calculated and stored in batches. The evaluation process may be stopped at any time. The next time it is run, it will continue from the point when it was stopped.';
$string['exportmodel'] = 'Export configuration';
$string['exporttrainingdata'] = 'Export training data';
$string['getpredictionsresultscli'] = 'Results using {$a->name} (id: {$a->id}) course duration splitting';
$string['getpredictionsresults'] = 'Results using {$a->name} course duration splitting';
$string['getpredictionsresultscli'] = 'Results using {$a->name} (id: {$a->id}) time-splitting method';
$string['getpredictionsresults'] = 'Results using {$a->name} time-splitting method';
$string['extrainfo'] = 'Info';
$string['generalerror'] = 'Evaluation error. Status code {$a}';
$string['getpredictions'] = 'Get predictions';
......
......@@ -119,7 +119,7 @@ switch ($action) {
'id' => $model->get_id(),
'trainedmodel' => $model->is_trained(),
'indicators' => $model->get_potential_indicators(),
'timesplittings' => \core_analytics\manager::get_enabled_time_splitting_methods(),
'timesplittings' => \core_analytics\manager::get_all_time_splittings(),
'predictionprocessors' => \core_analytics\manager::get_all_prediction_processors()
);
$mform = new \tool_analytics\output\form\edit_model(null, $customdata);
......
......@@ -254,11 +254,26 @@ class manager {
/**
* Returns the enabled time splitting methods.
*
* @deprecated since Moodle 3.7
* @todo MDL-65086 This will be deleted in Moodle 4.1
* @see \core_analytics\manager::get_time_splitting_methods_for_evaluation
* @return \core_analytics\local\time_splitting\base[]
*/
public static function get_enabled_time_splitting_methods() {
debugging('This function has been deprecated. You can use self::get_time_splitting_methods_for_evaluation if ' .
'you want to get the default time splitting methods for evaluation, or you can use self::get_all_time_splittings if ' .
'you want to get all the time splitting methods available on this site.');
return self::get_time_splitting_methods_for_evaluation();
}
/**
* Returns the default time splitting methods for model evaluation.
*
* @return \core_analytics\local\time_splitting\base[]
*/
public static function get_time_splitting_methods_for_evaluation() {
if ($enabledtimesplittings = get_config('analytics', 'timesplittings')) {
if ($enabledtimesplittings = get_config('analytics', 'defaulttimesplittingsevaluation')) {
$enabledtimesplittings = array_flip(explode(',', $enabledtimesplittings));
}
......
......@@ -289,7 +289,7 @@ class model {
$timesplitting = \core_analytics\manager::get_time_splitting($options['timesplitting']);
$timesplittings = array($timesplitting->get_id() => $timesplitting);
} else {
$timesplittings = \core_analytics\manager::get_enabled_time_splitting_methods();
$timesplittings = \core_analytics\manager::get_time_splitting_methods_for_evaluation();
}
} else {
......
......@@ -443,7 +443,7 @@ class core_analytics_prediction_testcase extends advanced_testcase {
$sometimesplittings = '\core\analytics\time_splitting\weekly,' .
'\core\analytics\time_splitting\single_range,' .
'\core\analytics\time_splitting\quarters';
set_config('timesplittings', $sometimesplittings, 'analytics');
set_config('defaulttimesplittingsevaluation', $sometimesplittings, 'analytics');
if ($modelquality === 'perfect') {
$model = $this->add_perfect_model();
......@@ -487,8 +487,6 @@ class core_analytics_prediction_testcase extends advanced_testcase {
$this->resetAfterTest(true);
$this->setAdminuser();
set_config('enabled_stores', 'logstore_standard', 'tool_log');
set_config('timesplittings',
'\core\analytics\time_splitting\quarters,\core\analytics\time_splitting\quarters_accum', 'analytics');
$model = $this->add_perfect_model();
......
......@@ -30,7 +30,8 @@ $string['analyticslogstore'] = 'Log store used for analytics';
$string['analyticslogstore_help'] = 'The log store that will be used by the analytics API to read users\' activity';
$string['analyticssettings'] = 'Analytics settings';
$string['coursetoolong'] = 'The course is too long';
$string['enabledtimesplittings'] = 'Time splitting methods';
$string['defaulttimesplittingmethods'] = 'Default time-splitting methods for model\'s evaluation';
$string['defaulttimesplittingmethods_help'] = 'The time-splitting method divides the course duration into parts; the predictions engine will run at the end of these parts. The model evaluation process will iterate through these time-splitting methods unless a specific time-splitting method is specified (the ability to specify a time-splitting method is only available when evaluating models using the command line script).';
$string['defaultpredictionsprocessor'] = 'Default predictions processor';
$string['defaultpredictoroption'] = 'Default processor ({$a})';
$string['disabledmodel'] = 'Disabled model';
......@@ -121,5 +122,5 @@ $string['privacy:metadata:analytics:predictionactions:timecreated'] = 'When the
$string['processingsitecontents'] = 'Processing site contents';
$string['successfullyanalysed'] = 'Successfully analysed';
$string['timesplittingmethod'] = 'Time-splitting method';
$string['timesplittingmethod_help'] = 'The time-splitting method divides the course duration into parts; the predictions engine will run at the end of these parts. It is recommended that you only enable the time-splitting methods you may be interested in using. The evaluation process will iterate through all enabled time-splitting methods, so the more time-splitting methods enabled, the slower the evaluation process will be.';
$string['timesplittingmethod_help'] = 'The time-splitting method is what defines when the system will calculate predictions and the portion of activity logs that will be considered for those predictions. E.g. They can divide the course duration in parts and generate a prediction at the end of these parts.';
$string['viewprediction'] = 'View prediction details';
......@@ -2905,5 +2905,17 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019030800.03);
}
if ($oldversion < 2019031500.01) {
$defaulttimesplittings = get_config('analytics', 'timesplittings');
if ($defaulttimesplittings !== false) {
set_config('defaulttimesplittingsevaluation', $defaulttimesplittings, 'analytics');
unset_config('timesplittings', 'analytics');
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2019031500.01);
}
return true;
}
......@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2019031500.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019031500.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment