From 16ca026c4b5a702c89b18e7d8091b475b9b8821e Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Tue, 28 Mar 2017 10:22:09 +0200 Subject: [PATCH] MDL-58415 mod_lesson: Force int type for calculated progress Under some circumstances the value returned by the function needs casting. --- mod/lesson/locallib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index fff9f82e672cb..3f22939853ce1 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -3107,7 +3107,8 @@ public function calculate_progress() { } // Progress calculation as a percent. - return round(count($viewedpageids) / count($validpages), 2) * 100; + $progress = round(count($viewedpageids) / count($validpages), 2) * 100; + return (int) $progress; } /**