Problem/Motivation

Drupal\moodle_rest\Services\RestFunctions::getCourseCompletionPercentage() often returns a float when an integer is specified by the return type.

Steps to reproduce

Fetching course completion for any incomplete course with completion criteria.

Proposed resolution

Round and cast to int? Or update the return type to float? Probably should round either way.

Remaining tasks

Patch incoming.

User interface changes

None.

API changes

None (or return type if that's preferred).

Data model changes

None.

CommentFileSizeAuthor
#2 course-completion-3245696-2.patch676 bytesjacktonkin

Comments

jacktonkin created an issue. See original summary.

jacktonkin’s picture

Assigned: jacktonkin » Unassigned
StatusFileSize
new676 bytes

Patch also returns NULL if there are no activities to avoid divide-by-zero warning.

  • ekes committed e9bbe26 on 0.1.x
    git commit -m 'Issue #3245696 by jacktonkin: Fatal error in Drupal\...
ekes’s picture

Status: Needs review » Fixed

Makes sense to me, and follows the actual return pattern.

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.