Skip to content

Commit

Permalink
Tracking: Remove config use_new_tracking_in_lp_item BT#18443
Browse files Browse the repository at this point in the history
The new tracking system depends in the course/session not in the LP.
Requires testing.
  • Loading branch information
jmontoyaa committed Mar 2, 2021
1 parent 0fc8fb6 commit d87d352
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
33 changes: 6 additions & 27 deletions main/inc/lib/tracking.lib.php
Expand Up @@ -157,21 +157,7 @@ public static function getLpStats(
}

$hideTime = api_get_configuration_value('hide_lp_time');
$allowNewTracking = api_get_configuration_value('use_new_tracking_in_lp_item');
$lp_id = (int) $lp_id;

if ($allowNewTracking) {
$extraField = new ExtraFieldValue('lp');
$result = $extraField->get_values_by_handler_and_field_variable($lp_id, 'track_lp_item');
if (empty($result)) {
$allowNewTracking = false;
} else {
if (isset($result['value']) && $result['value'] == 1) {
$allowNewTracking = true;
}
}
}

$lp_item_id = (int) $lp_item_id;
$user_id = (int) $user_id;
$session_id = (int) $session_id;
Expand Down Expand Up @@ -383,7 +369,7 @@ public static function getLpStats(
$time_for_total = 0;
$attemptResult = 0;

if ($allowNewTracking && $timeCourse) {
if ($timeCourse) {
if (isset($timeCourse['learnpath_detailed']) &&
isset($timeCourse['learnpath_detailed'][$lp_id]) &&
isset($timeCourse['learnpath_detailed'][$lp_id][$my_item_id])
Expand Down Expand Up @@ -476,7 +462,7 @@ public static function getLpStats(
$extend_attempt_link = '';
$extend_this_attempt = 0;

if ($allowNewTracking && $timeCourse) {
if ($timeCourse) {
//$attemptResult = 0;
if (isset($timeCourse['learnpath_detailed']) &&
isset($timeCourse['learnpath_detailed'][$lp_id]) &&
Expand Down Expand Up @@ -534,17 +520,14 @@ public static function getLpStats(
$attemptTime = $row['mytime'];

if ($minimumAvailable) {
$lp_time = $timeCourse[TOOL_LEARNPATH];
/*$lp_time = $timeCourse[TOOL_LEARNPATH];
$lpTime = null;
if (isset($lp_time[$lp_id])) {
$lpTime = (int) $lp_time[$lp_id];
}
$time_for_total = $lpTime;

if ($allowNewTracking) {
$time_for_total = (int) $attemptResult;
$attemptTime = (int) $attemptResult;
}
$time_for_total = $lpTime;*/
$time_for_total = (int) $attemptResult;
$attemptTime = (int) $attemptResult;
}

$time = learnpathItem::getScormTimeFromParameter('js', $attemptTime);
Expand Down Expand Up @@ -765,10 +748,6 @@ public static function getLpStats(
$subtotal_time += $tmp_row['mytime'];
}

if ($allowNewTracking) {
$subtotal_time = $attemptResult;
}

$title = $row['mytitle'];
// Selecting the exe_id from stats attempts tables in order to look the max score value.
$sql = 'SELECT * FROM '.$tbl_stats_exercices.'
Expand Down
4 changes: 0 additions & 4 deletions main/install/configuration.dist.php
Expand Up @@ -1159,10 +1159,6 @@
*/
//$_configuration['lp_minimum_time'] = false;

// Track LP attempts using the new tracking system.
// Requires to add an LP extra field called "track_lp_item" (checkbox) in order to use this feature.
//$_configuration['use_new_tracking_in_lp_item'] = false;

// Add collapsable option for user course categories
// ALTER TABLE user_course_category ADD collapsed TINYINT(1) DEFAULT NULL;
// $_configuration['allow_user_course_category_collapsable'] = false;
Expand Down

0 comments on commit d87d352

Please sign in to comment.