Fix generate certificates on the first time when user load the gradebook page - refs #7977

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 763a36713f
commit 3bd493d805
  1. 9
      main/gradebook/lib/be/category.class.php

@ -1942,7 +1942,7 @@ class Category implements GradebookItem
// A student always sees only the teacher's repartition // A student always sees only the teacher's repartition
$scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT); $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; return false;
} }
@ -2143,6 +2143,7 @@ class Category implements GradebookItem
* To check by the category ID * To check by the category ID
* @param string $courseCode Optional. The course code * @param string $courseCode Optional. The course code
* @param int $sessionId Optional. The session ID * @param int $sessionId Optional. The session ID
* @param boolean $recalcutateScore Whether recalculate the score
* @return boolean * @return boolean
*/ */
public static function userFinishedCourse( public static function userFinishedCourse(
@ -2150,7 +2151,8 @@ class Category implements GradebookItem
\Category $category = null, \Category $category = null,
$categoryId = 0, $categoryId = 0,
$courseCode = null, $courseCode = null,
$sessionId = 0 $sessionId = 0,
$recalcutateScore = false
) { ) {
if (is_null($category) && empty($categoryId)) { if (is_null($category) && empty($categoryId)) {
return false; return false;
@ -2181,7 +2183,8 @@ class Category implements GradebookItem
$userId, $userId,
$category->get_id(), $category->get_id(),
$courseCode, $courseCode,
$sessionId $sessionId,
$recalcutateScore
); );
$minCertificateScore = $category->get_certificate_min_score(); $minCertificateScore = $category->get_certificate_min_score();

Loading…
Cancel
Save