Minor - remove unused code + format code

pull/3223/head
Julio Montoya 6 years ago
parent 516dd6fd10
commit d84af474a3
  1. 2
      main/exercise/exercise.class.php
  2. 26
      main/lp/lp_ajax_switch_item.php

@ -8572,7 +8572,7 @@ class Exercise
$result_total = Database::query($total_sql); $result_total = Database::query($total_sql);
$total_exercises = 0; $total_exercises = 0;
if (Database :: num_rows($result_total)) { if (Database::num_rows($result_total)) {
$result_total = Database::fetch_array($result_total); $result_total = Database::fetch_array($result_total);
$total_exercises = $result_total['count']; $total_exercises = $result_total['count'];
} }

@ -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.lms_item_core_exit = '".$mycore_exit."';".
"olms.asset_timer = 0;"; "olms.asset_timer = 0;";
$sessionId = api_get_session_id();
$updateMinTime = ''; $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(); $timeLp = $mylp->getAccumulateWorkTime();
$timeTotalCourse = $mylp->getAccumulateWorkTimeTotalCourse(); $timeTotalCourse = $mylp->getAccumulateWorkTimeTotalCourse();
// Minimum connection percentage // Minimum connection percentage
$perc = 100; $perc = 100;
// Time from the course // Time from the course
$tc = $timeTotalCourse; $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 // Percentage of the learning paths
$pl = 0; $pl = 0;
if (!empty($timeTotalCourse)) { 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 // Minimum time for each learning path
$time_total = intval($pl * $tc * $perc / 100) * 60; $time_total = intval($pl * $tc * $perc / 100) * 60;
$lpTimeList = Tracking::getCalculateTime($user_id, api_get_course_int_id(), $sessionId);
//$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());
$lpTime = isset($lpTimeList[TOOL_LEARNPATH][$lp_id]) ? $lpTimeList[TOOL_LEARNPATH][$lp_id] : 0; $lpTime = isset($lpTimeList[TOOL_LEARNPATH][$lp_id]) ? $lpTimeList[TOOL_LEARNPATH][$lp_id] : 0;
if ($lpTime >= $time_total) { if ($lpTime >= $time_total) {
@ -278,7 +259,6 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
; ;
$return .= 'updateGamificationValues(); '; $return .= 'updateGamificationValues(); ';
$mylp->set_error_msg(''); $mylp->set_error_msg('');
$mylp->prerequisites_match(); // Check the prerequisites are all complete. $mylp->prerequisites_match(); // Check the prerequisites are all complete.
if ($debug > 1) { if ($debug > 1) {

Loading…
Cancel
Save