MDL-58859 analytics: No enddate update if wrong guess
Part of MDL-57791 epic.
This commit is contained in:
committed by
David Monllao
parent
fa76feff86
commit
d2cdaf68ae
@@ -77,7 +77,7 @@ if ($options['filter'] !== false) {
|
||||
// We need admin permissions.
|
||||
\core\session\manager::set_user(get_admin());
|
||||
|
||||
$conditions = array();
|
||||
$conditions = array('id != 1');
|
||||
if (!$options['guessall']) {
|
||||
if ($options['guessstart']) {
|
||||
$conditions[] = '(startdate is null or startdate = 0)';
|
||||
@@ -174,10 +174,17 @@ function tool_models_calculate_course_dates($course, $options) {
|
||||
// Update it to something we guess.
|
||||
|
||||
$course->enddate = $guessedenddate;
|
||||
$notification .= PHP_EOL . ' ' . get_string('enddate') . ': ' . userdate($guessedenddate);
|
||||
|
||||
if ($course->enddate > $course->startdate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('enddate') . ': ' . userdate($course->enddate);
|
||||
} else {
|
||||
$notification .= PHP_EOL . ' ' . get_string('errorendbeforestart', 'analytics', userdate($course->enddate));
|
||||
}
|
||||
|
||||
if ($options['update']) {
|
||||
update_course($course);
|
||||
if ($course->enddate > $course->startdate) {
|
||||
update_course($course);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ $string['analyticssettings'] = 'Analytics settings';
|
||||
$string['enabledtimesplittings'] = 'Time splitting methods';
|
||||
$string['enabledtimesplittings_help'] = 'The time splitting method divides the course duration in parts, the predictions engine will run at the end of these parts. It is recommended that you only enable the time splitting methods you could be interested on using; the evaluation process will iterate through all of them so the more time splitting methods to go through the slower the evaluation process will be.';
|
||||
$string['erroralreadypredict'] = '{$a} file has already been used to predict';
|
||||
$string['errorendbeforestart'] = 'The guessed end date ({$a}) is before the course start date.';
|
||||
$string['errorinvalidindicator'] = 'Invalid {$a} indicator';
|
||||
$string['errorinvalidtimesplitting'] = 'Invalid time splitting, please ensure you added the class fully qualified class name';
|
||||
$string['errornoindicators'] = 'This model does not have any indicator';
|
||||
|
||||
Reference in New Issue
Block a user