mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-59786 analytics: Discard invalid samples
This commit is contained in:
parent
b3cfb01316
commit
1a5204a427
4 changed files with 49 additions and 9 deletions
|
@ -32,6 +32,8 @@ require_once($CFG->dirroot . '/course/format/weeks/lib.php');
|
|||
|
||||
$help = "Guesses course start and end dates based on activity logs.
|
||||
|
||||
IMPORTANT: Don't use this script if you keep previous academic years users enrolled in courses. Guesses would not be accurate.
|
||||
|
||||
Options:
|
||||
--guessstart Guess the course start date (default to true)
|
||||
--guessend Guess the course end date (default to true)
|
||||
|
@ -183,10 +185,14 @@ function tool_analytics_calculate_course_dates($course, $options) {
|
|||
|
||||
$course->enddate = $guessedenddate;
|
||||
|
||||
if ($course->enddate > $course->startdate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('enddate') . ': ' . userdate($course->enddate);
|
||||
} else {
|
||||
$updateit = false;
|
||||
if ($course->enddate < $course->startdate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('errorendbeforestart', 'analytics', userdate($course->enddate));
|
||||
} else if ($course->startdate + (YEARSECS + (WEEKSECS * 4)) > $course->enddate) {
|
||||
$notification .= PHP_EOL . ' ' . get_string('coursetoolong', 'analytics');
|
||||
} else {
|
||||
$notification .= PHP_EOL . ' ' . get_string('enddate') . ': ' . userdate($course->enddate);
|
||||
$updateit = true;
|
||||
}
|
||||
|
||||
if ($options['update']) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue