Fix get_time_spent_on_the_platform - refs BT#11032

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 9 years ago
parent 593eec5251
commit 8faf4d6f47
  1. 10
      main/inc/lib/tracking.lib.php

@ -1358,16 +1358,18 @@ class Tracking
$timeFilter = 'last_week';
}
$today = date('Y-m-d H:i:s');
$today = new DateTime('now', new DateTimeZone('UTC'));
switch ($timeFilter) {
case 'last_7_days':
$new_date = date('Y-m-d H:i:s', strtotime('-7 day'));
$condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") ';
$newDate = new DateTime('-7 day', new DateTimeZone('UTC'));
$condition_time = " AND (login_date >= '{$newDate->format('Y-m-d H:i:s')}'";
$condition_time .= " AND logout_date <= '{$today->format('Y-m-d H:i:s')}') ";
break;
case 'last_30_days':
$new_date = date('Y-m-d H:i:s', strtotime('-30 day'));
$condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") ';
$condition_time = " AND (login_date >= '{$new_date->format('Y-m-d H:i:s')}'";
$condition_time .= "AND logout_date <= '{$today->format('Y-m-d H:i:s')}') ";
break;
case 'custom':
if (!empty($start_date) && !empty($end_date)) {

Loading…
Cancel
Save