From d84af474a3cd6455f2545189f2081cc0c1afc82c Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 29 Apr 2020 09:12:45 +0200 Subject: [PATCH] Minor - remove unused code + format code --- main/exercise/exercise.class.php | 2 +- main/lp/lp_ajax_switch_item.php | 26 +++----------------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 54f9fb7803..3709d30206 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -8572,7 +8572,7 @@ class Exercise $result_total = Database::query($total_sql); $total_exercises = 0; - if (Database :: num_rows($result_total)) { + if (Database::num_rows($result_total)) { $result_total = Database::fetch_array($result_total); $total_exercises = $result_total['count']; } diff --git a/main/lp/lp_ajax_switch_item.php b/main/lp/lp_ajax_switch_item.php index 828b5b1bca..269f39149d 100755 --- a/main/lp/lp_ajax_switch_item.php +++ b/main/lp/lp_ajax_switch_item.php @@ -217,25 +217,15 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it "olms.lms_item_core_exit = '".$mycore_exit."';". "olms.asset_timer = 0;"; + $sessionId = api_get_session_id(); $updateMinTime = ''; - if (Tracking::minimumTimeAvailable(api_get_session_id(), api_get_course_int_id())) { + if (Tracking::minimumTimeAvailable($sessionId, api_get_course_int_id())) { $timeLp = $mylp->getAccumulateWorkTime(); $timeTotalCourse = $mylp->getAccumulateWorkTimeTotalCourse(); // Minimum connection percentage $perc = 100; // Time from the course $tc = $timeTotalCourse; - $sessionId = api_get_session_id(); - if (!empty($sessionId) && $sessionId != 0) { - /*$sql = "SELECT hours, perc FROM plugin_licences_course_session WHERE session_id = $sessionId"; - $res = Database::query($sql); - if (Database::num_rows($res) > 0) { - $aux = Database::fetch_assoc($res); - $perc = $aux['perc']; - $tc = $aux['hours'] * 60; - }*/ - } - // Percentage of the learning paths $pl = 0; if (!empty($timeTotalCourse)) { @@ -244,16 +234,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it // Minimum time for each learning path $time_total = intval($pl * $tc * $perc / 100) * 60; - - //$time_total = $mylp->getAccumulateWorkTime() * 60; - /*$lpTime = Tracking::get_time_spent_in_lp( - $user_id, - api_get_course_id(), - [$lp_id], - api_get_session_id() - );*/ - - $lpTimeList = Tracking::getCalculateTime($user_id, api_get_course_int_id(), api_get_session_id()); + $lpTimeList = Tracking::getCalculateTime($user_id, api_get_course_int_id(), $sessionId); $lpTime = isset($lpTimeList[TOOL_LEARNPATH][$lp_id]) ? $lpTimeList[TOOL_LEARNPATH][$lp_id] : 0; if ($lpTime >= $time_total) { @@ -278,7 +259,6 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it ; $return .= 'updateGamificationValues(); '; - $mylp->set_error_msg(''); $mylp->prerequisites_match(); // Check the prerequisites are all complete. if ($debug > 1) {