Change time diff BT#16844

pull/3128/head
Julio Montoya 6 years ago
parent d54d1848ae
commit cdfedd96ca
  1. 23
      main/mySpace/access_details_session.php

@ -423,23 +423,29 @@ if ($formByDay->validate()) {
$list = Tracking::get_time_spent_on_the_platform($userId, 'custom', $from, $to, true);
$newList = [];
foreach ($list as $list) {
$key = substr($list['login_date'], 0, 10);
foreach ($list as $item) {
$key = substr($item['login_date'], 0, 10);
if (!isset($newList[$key])) {
$newList[$key] = [
'login_date' => $list['login_date'],
'logout_date' => $list['logout_date'],
'diff' => $list['diff'],
'login_date' => $item['login_date'],
'logout_date' => $item['logout_date'],
'diff' => 0,
];
} else {
$newList[$key] = [
'login_date' => $newList[$key]['login_date'],
'logout_date' => $list['logout_date'],
'diff' => $newList[$key]['diff'] + $list['diff'],
'logout_date' => $item['logout_date'],
'diff' => 0,
];
}
}
if (!empty($newList)) {
foreach ($newList as &$item) {
$item['diff'] = api_strtotime($item['logout_date']) - api_strtotime($item['login_date']);
}
}
$period = new DatePeriod(
$fromObject,
new DateInterval('P1D'),
@ -462,9 +468,6 @@ if ($formByDay->validate()) {
get_lang('Total'),
];
/*$table->setHeaderContents(0, 0, $dateToCheck);
$table->setCellAttributes(0,0,['colspan' => 3]);*/
$row = 0;
$column = 0;
foreach ($headers as $header) {

Loading…
Cancel
Save