From 3bd493d805d399fe80a6d49af80f3796061a842e Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 17 Dec 2015 19:47:14 -0500 Subject: [PATCH] Fix generate certificates on the first time when user load the gradebook page - refs #7977 --- main/gradebook/lib/be/category.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index 3cdf490fba..1ed47ca9ce 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -1942,7 +1942,7 @@ class Category implements GradebookItem // A student always sees only the teacher's repartition $scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT); - if (!self::userFinishedCourse($user_id, $cats_course[0], 0, $courseCode, $sessionId)) { + if (!self::userFinishedCourse($user_id, $cats_course[0], 0, $courseCode, $sessionId, true)) { return false; } @@ -2143,6 +2143,7 @@ class Category implements GradebookItem * To check by the category ID * @param string $courseCode Optional. The course code * @param int $sessionId Optional. The session ID + * @param boolean $recalcutateScore Whether recalculate the score * @return boolean */ public static function userFinishedCourse( @@ -2150,7 +2151,8 @@ class Category implements GradebookItem \Category $category = null, $categoryId = 0, $courseCode = null, - $sessionId = 0 + $sessionId = 0, + $recalcutateScore = false ) { if (is_null($category) && empty($categoryId)) { return false; @@ -2181,7 +2183,8 @@ class Category implements GradebookItem $userId, $category->get_id(), $courseCode, - $sessionId + $sessionId, + $recalcutateScore ); $minCertificateScore = $category->get_certificate_min_score();