summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting/inc/statisticreporting.inc.php
diff options
context:
space:
mode:
authorChristian Hofmaier2016-12-22 15:07:02 +0100
committerChristian Hofmaier2016-12-22 15:07:02 +0100
commitb9e1d1a3780d0cbb26e84a17106805895795edf9 (patch)
tree2f1bbbd6e5ce91365ac9b61bff76ed04a69dff82 /modules-available/statistics_reporting/inc/statisticreporting.inc.php
parent[statistics_reporting] improved short session queries (diff)
downloadslx-admin-b9e1d1a3780d0cbb26e84a17106805895795edf9.tar.gz
slx-admin-b9e1d1a3780d0cbb26e84a17106805895795edf9.tar.xz
slx-admin-b9e1d1a3780d0cbb26e84a17106805895795edf9.zip
[statistics_reporting] improved short session queries (bugfix)
Diffstat (limited to 'modules-available/statistics_reporting/inc/statisticreporting.inc.php')
-rw-r--r--modules-available/statistics_reporting/inc/statisticreporting.inc.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules-available/statistics_reporting/inc/statisticreporting.inc.php b/modules-available/statistics_reporting/inc/statisticreporting.inc.php
index 560ac2c2..afa3e7ac 100644
--- a/modules-available/statistics_reporting/inc/statisticreporting.inc.php
+++ b/modules-available/statistics_reporting/inc/statisticreporting.inc.php
@@ -7,7 +7,7 @@ class StatisticReporting
public static function getClientStatistics($cutOffTimeInSeconds, $lowerTimeBound = 0, $upperTimeBound = 24) {
$queryTime = time() - $cutOffTimeInSeconds;
$res = Database::simpleQuery("SELECT t1.name, timeSum, medianTime, offlineSum, longSessions, lastLogout, lastStart, shortSessions FROM (
- SELECT machine.hostname AS 'name', machine.machineuuid AS 'uuid', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', COUNT(sessionTable.length >= 60) AS 'longSessions', COUNT(sessionTable.length < 60) AS 'shortSessions',MAX(sessionTable.dateline + sessionTable.data) AS 'lastLogout'
+ SELECT machine.hostname AS 'name', machine.machineuuid AS 'uuid', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions',MAX(sessionTable.dateline + sessionTable.data) AS 'lastLogout'
FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound)." sessionTable
INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid
WHERE sessionTable.dateline>=$queryTime
@@ -29,7 +29,7 @@ class StatisticReporting
$queryTime = time() - $cutOffTimeInSeconds;
$res = Database::simpleQuery("SELECT t1.locName, timeSum, medianTime, offlineSum, longSessions, shortSessions FROM (
- SELECT IFNULL(location.locationname, '') AS 'locName', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', COUNT(sessionTable.length >= 60) AS 'longSessions', COUNT(sessionTable.length < 60) AS 'shortSessions'
+ SELECT IFNULL(location.locationname, '') AS 'locName', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions'
FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound)." sessionTable
INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid
LEFT JOIN location ON machine.locationid = location.locationid
@@ -69,7 +69,7 @@ class StatisticReporting
public static function getOverallStatistics ($cutOffTimeInSeconds, $lowerTimeBound = 0, $upperTimeBound = 24) {
$queryTime = time() - $cutOffTimeInSeconds;
- $res = Database::simpleQuery("SELECT SUM(CAST(sessionTable.length AS UNSIGNED)) AS sum, GROUP_CONCAT(sessionTable.length) AS median, COUNT(sessionTable.length >= 60) AS longSessions, COUNT(sessionTable.length < 60) AS shortSessions
+ $res = Database::simpleQuery("SELECT SUM(CAST(sessionTable.length AS UNSIGNED)) AS sum, GROUP_CONCAT(sessionTable.length) AS median, SUM(sessionTable.length >= 60) AS longSessions, SUM(sessionTable.length < 60) AS shortSessions
FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound)." sessionTable
WHERE sessionTable.dateline>=$queryTime");
return $res;