MDL-58333 enrol: Include course progress in course listing WS

Part of MDL-55611 epic.
This commit is contained in:
Andrew Nicols
2017-04-04 11:01:43 +01:00
committed by Dan Poltawski
parent 08db22c105
commit 80ece0847e
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -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),
)
)
);
+1 -1
View File
@@ -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.