From c727e69e691c79a8e686516bed97a52f8f85c439 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 8 Feb 2012 19:25:03 +0100 Subject: [PATCH] Fixing time to avoid negative values see BT#3627 --- main/inc/lib/tracking.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 23832be40b..7e0044b66d 100644 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -106,9 +106,9 @@ class Tracking { $sql = "SELECT SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds FROM $tbl_track_course - WHERE course_code='$course_code' AND session_id = '$session_id' $condition_user"; - - $rs = Database::query($sql); + WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) AND course_code='$course_code' AND session_id = '$session_id' $condition_user"; + + $rs = Database::query($sql); $row = Database::fetch_array($rs); return $row['nb_seconds']; }