From 6981444fbf6d7a7acd0081dae202ec99c7b91dc0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 22 Apr 2020 15:06:22 +0200 Subject: [PATCH] Fix set correct max score BT#17086 --- main/lp/learnpathItem.class.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/main/lp/learnpathItem.class.php b/main/lp/learnpathItem.class.php index cbe0bb82a7..bad541f62d 100755 --- a/main/lp/learnpathItem.class.php +++ b/main/lp/learnpathItem.class.php @@ -1,4 +1,5 @@ */ class learnpathItem @@ -80,6 +79,7 @@ class learnpathItem private $last_scorm_session_time = 0; private $prerequisiteMaxScore; private $prerequisiteMinScore; + public $view_max_score; /** * Prepares the learning path item for later launch. @@ -145,6 +145,7 @@ class learnpathItem $this->setPrerequisiteMaxScore($row['prerequisite_max_score']); $this->setPrerequisiteMinScore($row['prerequisite_min_score']); $this->oldTotalTime = 0; + $this->view_max_score = 0; if (isset($row['launch_data'])) { $this->launch_data = $row['launch_data']; @@ -754,14 +755,7 @@ class learnpathItem public function get_max() { if ($this->type === 'sco') { - if (isset($this->view_max_score) && - !empty($this->view_max_score) && - $this->view_max_score > 0 - ) { - return $this->view_max_score; - } elseif (isset($this->view_max_score) && - $this->view_max_score === '' - ) { + if (!empty($this->view_max_score) && $this->view_max_score > 0) { return $this->view_max_score; } else { if (!empty($this->max_score)) { @@ -2656,6 +2650,7 @@ class learnpathItem return true; } + $this->save(); $allowed = $this->isRestartAllowed(); @@ -2727,7 +2722,6 @@ class learnpathItem 0 ); } - // Get all new settings from the URL if ($from_outside) { if ($debug) { @@ -3719,6 +3713,7 @@ class learnpathItem 0 ); } + $check_res = Database::query($sql); // Depending on what we want (really), we'll update or insert a new row // now save into DB.