From 6ff8d314340c8c52446a2a096e8c69905bcb1dca Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 23 Jan 2019 13:42:01 +0800 Subject: [PATCH] MDL-64644 completion: set status correctly in provider --- completion/classes/privacy/provider.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/completion/classes/privacy/provider.php b/completion/classes/privacy/provider.php index 1d06aeb71a4..0861a0e1119 100644 --- a/completion/classes/privacy/provider.php +++ b/completion/classes/privacy/provider.php @@ -166,12 +166,19 @@ class provider implements } $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') : ''; - $status = (!$criteriacomplete && !$ccompletion->timestarted) ? get_string('notyetstarted', 'completion') : - get_string('inprogress', 'completion'); + if ($coursecomplete) { + $status = get_string('complete'); + } 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); $overall = get_string('nocriteriaset', 'completion');