From 47a8eebcda2c841193420e6e7bb5ec847940f753 Mon Sep 17 00:00:00 2001 From: Christian Hofmaier Date: Thu, 22 Dec 2016 14:03:29 +0100 Subject: [statistics_reporting] better variable names --- .../statistics_reporting/inc/statisticreporting.inc.php | 6 +++--- modules-available/statistics_reporting/page.inc.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules-available/statistics_reporting') diff --git a/modules-available/statistics_reporting/inc/statisticreporting.inc.php b/modules-available/statistics_reporting/inc/statisticreporting.inc.php index d98ec168..2c4acaf1 100644 --- a/modules-available/statistics_reporting/inc/statisticreporting.inc.php +++ b/modules-available/statistics_reporting/inc/statisticreporting.inc.php @@ -87,13 +87,13 @@ class StatisticReporting public static function getOverallStatistics ($cutOffTimeInSeconds, $lowerTimeBound = 0, $upperTimeBound = 24) { $queryTime = time() - $cutOffTimeInSeconds; - $res = Database::simpleQuery("SELECT sum, median, countLong, countShort FROM - ( SELECT SUM(CAST(sessionTable.length AS UNSIGNED)) AS sum, GROUP_CONCAT(sessionTable.length) AS median, COUNT(*) AS countLong + $res = Database::simpleQuery("SELECT sum, median, longSessions, shortSessions FROM + ( SELECT SUM(CAST(sessionTable.length AS UNSIGNED)) AS sum, GROUP_CONCAT(sessionTable.length) AS median, COUNT(*) AS longSessions FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound)." sessionTable WHERE sessionTable.dateline>=$queryTime AND sessionTable.data >= 60 ) t1 INNER JOIN - ( SELECT COUNT(sessionTable.length) as countShort + ( SELECT COUNT(sessionTable.length) as shortSessions FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound)." sessionTable WHERE sessionTable.dateline>=$queryTime AND sessionTable.data < 60 ) t2"); diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 0dd4f243..de13cdb3 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -35,7 +35,7 @@ class Page_Statistics_Reporting extends Page // total time online, average time online, total number of logins $res = StatisticReporting::getOverallStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $row = $res->fetch(PDO::FETCH_NUM); - $data = array('time' => StatisticReporting::formatSeconds($row[0]), 'medianTime' => StatisticReporting::formatSeconds(StatisticReporting::calcMedian($row[1])), 'totalLogins' => $row[2]); + $data = array('time' => StatisticReporting::formatSeconds($row[0]), 'medianTime' => StatisticReporting::formatSeconds(StatisticReporting::calcMedian($row[1])), 'totalLogins' => $row[2], 'shortSessions' => $row[3]); //total time offline $res = StatisticReporting::getTotalOfflineStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); @@ -48,7 +48,7 @@ class Page_Statistics_Reporting extends Page while ($row = $res->fetch(PDO::FETCH_NUM)) { $median = StatisticReporting::calcMedian(StatisticReporting::calcMedian($row[2])); $data['perLocation'][] = array('location' => $row[0], 'time' => StatisticReporting::formatSeconds($row[1]), 'timeInSeconds' => $row[1], - 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row[3]), 'offlineTimeInSeconds' => $row[3], 'loginCount' => $row[4]); + 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row[3]), 'offlineTimeInSeconds' => $row[3], 'loginCount' => $row[4], 'shortSessions' => $row[5]); } // per client @@ -58,7 +58,7 @@ class Page_Statistics_Reporting extends Page $median = StatisticReporting::calcMedian(StatisticReporting::calcMedian($row[2])); $data['perClient'][] = array('hostname' => $row[0], 'time' => StatisticReporting::formatSeconds($row[1]), 'timeInSeconds' => $row[1], 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row[3]), 'offlineTimeInSeconds' => $row[3], 'loginCount' => $row[4], - 'lastLogout' => date(DATE_RSS,$row[5]), 'lastLogoutUnixtime' => $row[5], 'lastStart' => date(DATE_RSS,$row[6]), 'lastStartUnixtime' => $row[6]); + 'lastLogout' => date(DATE_RSS,$row[5]), 'lastLogoutUnixtime' => $row[5], 'lastStart' => date(DATE_RSS,$row[6]), 'lastStartUnixtime' => $row[6], 'shortSessions' => $row[7]); } // per user -- cgit v1.2.3-55-g7522