MDL-64644 completion: set status correctly in provider

This commit is contained in:
Mark Nelson 2019-01-23 13:42:01 +08:00
parent aaf7228fb4
commit 6ff8d31434

View File

@ -166,12 +166,19 @@ class provider implements
} }
$coursecomplete = $completioninfo->is_course_complete($user->id); $coursecomplete = $completioninfo->is_course_complete($user->id);
$criteriacomplete = $completioninfo->count_course_user_data($user->id);
$ccompletion = new \completion_completion(['userid' => $user->id, 'course' => $course->id]);
$status = ($coursecomplete) ? get_string('complete') : ''; if ($coursecomplete) {
$status = (!$criteriacomplete && !$ccompletion->timestarted) ? get_string('notyetstarted', 'completion') : $status = get_string('complete');
get_string('inprogress', 'completion'); } else {
$criteriacomplete = $completioninfo->count_course_user_data($user->id);
$ccompletion = new \completion_completion(['userid' => $user->id, 'course' => $course->id]);
if (!$criteriacomplete && !$ccompletion->timestarted) {
$status = get_string('notyetstarted', 'completion');
} else {
$status = get_string('inprogress', 'completion');
}
}
$completions = $completioninfo->get_completions($user->id); $completions = $completioninfo->get_completions($user->id);
$overall = get_string('nocriteriaset', 'completion'); $overall = get_string('nocriteriaset', 'completion');