Tracking: add option to define a specific fixed time to add to the registry when logging out from a course and no recent registry exists - refs BT#21501

pull/5610/head
NicoDucou 1 year ago
parent e256dff020
commit 3299a6b115
  1. 8
      main/inc/lib/events.lib.php
  2. 2
      main/install/configuration.dist.php

@ -2385,9 +2385,15 @@ class Event
}
if ($insert) {
$defaultExtraTime = api_get_configuration_value('tracking_default_course_extra_time_on_logout');
$loginCourseDate = $currentDate = api_get_utc_datetime();
if (!empty($defaultExtraTime)) {
$loginDiff = time() - $defaultExtraTime;
$loginCourseDate = api_get_utc_datetime($loginDiff);
}
$ip = Database::escape_string(api_get_real_ip());
$sql = "INSERT INTO $tableCourseAccess (c_id, user_ip, user_id, login_course_date, logout_course_date, counter, session_id)
VALUES ($courseId, '$ip', $userId, '$currentDate', '$currentDate', 1, $sessionId)";
VALUES ($courseId, '$ip', $userId, '$loginCourseDate', '$currentDate', 1, $sessionId)";
Database::query($sql);
}

@ -2559,3 +2559,5 @@ INSERT INTO extra_field_options (field_id, option_value, display_text, priority,
// Define the maximum time in seconds to be registered if no action by user in the LP for more than the php session lifetime.
//$_configuration['time_to_be_registered_for_abusiveTime'] = 600;
// Define the default time in seconds to be registered if the user does logout from a course and there is no recent entry in track_e_course_access.
//$_configuration['tracking_default_course_extra_time_on_logout'] = 600;

Loading…
Cancel
Save