diff --git a/lang/en/moodle.php b/lang/en/moodle.php index e36d9704e5aec..4ce65d91b1f93 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -292,6 +292,7 @@ $string['country'] = 'Country'; $string['course'] = 'Course'; $string['courseadministration'] = 'Course administration'; +$string['coursealreadyfinished'] = 'Course already finished'; $string['courseapprovedemail'] = 'Your requested course, {$a->name}, has been approved and you have been made a {$a->teacher}. To access your new course, go to {$a->url}'; $string['courseapprovedemail2'] = 'Your requested course, {$a->name}, has been approved. To access your new course, go to {$a->url}'; $string['courseapprovedfailed'] = 'Failed to save the course as approved!'; diff --git a/lib/classes/analytics/target/course_dropout.php b/lib/classes/analytics/target/course_dropout.php index 9787b815d9743..b44ec4d34ae75 100644 --- a/lib/classes/analytics/target/course_dropout.php +++ b/lib/classes/analytics/target/course_dropout.php @@ -158,6 +158,11 @@ public function is_valid_analysable(\core_analytics\analysable $course, $fortrai return get_string('coursetoolong', 'analytics'); } + // Finished courses can not be used to get predictions. + if (!$fortraining && $course->is_finished()) { + return get_string('coursealreadyfinished'); + } + // Ongoing courses data can not be used to train. if ($fortraining && !$course->is_finished()) { return get_string('coursenotyetfinished');