From 80ece0847eabcdbdc6a91dffce93aa3a22665c75 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 23 Mar 2017 15:57:45 +0800 Subject: [PATCH] MDL-58333 enrol: Include course progress in course listing WS Part of MDL-55611 epic. --- enrol/externallib.php | 9 ++++++++- version.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/enrol/externallib.php b/enrol/externallib.php index 711cc69ceb8..588fbf96f69 100644 --- a/enrol/externallib.php +++ b/enrol/externallib.php @@ -326,6 +326,11 @@ class core_enrol_external extends external_api { $course->fullname = external_format_string($course->fullname, $context->id); $course->shortname = external_format_string($course->shortname, $context->id); + $progress = null; + if ($course->enablecompletion) { + $progress = \core_completion\progress::get_course_progress_percentage($course); + } + $result[] = array( 'id' => $course->id, 'shortname' => $course->shortname, @@ -339,7 +344,8 @@ class core_enrol_external extends external_api { 'showgrades' => $course->showgrades, 'lang' => $course->lang, 'enablecompletion' => $course->enablecompletion, - 'category' => $course->category + 'category' => $course->category, + 'progress' => $progress, ); } @@ -369,6 +375,7 @@ class core_enrol_external extends external_api { 'enablecompletion' => new external_value(PARAM_BOOL, 'true if completion is enabled, otherwise false', VALUE_OPTIONAL), 'category' => new external_value(PARAM_INT, 'course category id', VALUE_OPTIONAL), + 'progress' => new external_value(PARAM_FLOAT, 'Progress percentage', VALUE_OPTIONAL), ) ) ); diff --git a/version.php b/version.php index 986976fd6aa..d37171ec4c9 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2017040300.10; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2017040300.11; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.