summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting
diff options
context:
space:
mode:
authorSimon Rettberg2017-02-08 13:38:04 +0100
committerSimon Rettberg2017-02-08 13:38:04 +0100
commit3a09daee1ebaf014536e14e82ca0fd4c2c92a41f (patch)
tree5e2237b3cb98647e72109920f2ffde19f7ede52c /modules-available/statistics_reporting
parent[statistics_reporting] Update translations (diff)
downloadslx-admin-3a09daee1ebaf014536e14e82ca0fd4c2c92a41f.tar.gz
slx-admin-3a09daee1ebaf014536e14e82ca0fd4c2c92a41f.tar.xz
slx-admin-3a09daee1ebaf014536e14e82ca0fd4c2c92a41f.zip
[statistics_reporting] Consistent field naming across classes, templates etc.
Diffstat (limited to 'modules-available/statistics_reporting')
-rw-r--r--modules-available/statistics_reporting/inc/getdata.inc.php46
-rw-r--r--modules-available/statistics_reporting/inc/queries.inc.php8
-rw-r--r--modules-available/statistics_reporting/templates/table-client.html8
-rw-r--r--modules-available/statistics_reporting/templates/table-location.html8
-rw-r--r--modules-available/statistics_reporting/templates/table-total.html8
5 files changed, 39 insertions, 39 deletions
diff --git a/modules-available/statistics_reporting/inc/getdata.inc.php b/modules-available/statistics_reporting/inc/getdata.inc.php
index 9604d652..83f118e6 100644
--- a/modules-available/statistics_reporting/inc/getdata.inc.php
+++ b/modules-available/statistics_reporting/inc/getdata.inc.php
@@ -17,17 +17,17 @@ class GetData
// total time online, average time online, total number of logins
$res = Queries::getOverallStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$row = $res->fetch(PDO::FETCH_ASSOC);
- $data = array('time' => $row['sum'], 'medianTime' => self::calcMedian($row['median']), 'sessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions']);
+ $data = array('totalTime' => $row['sum'], 'medianSessionLength' => self::calcMedian($row['median']), 'longSessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions']);
//total time offline
$res = Queries::getTotalOfflineStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$row = $res->fetch(PDO::FETCH_ASSOC);
- $data = array_merge($data, array('totalOfftime' => $row['timeOff']));
+ $data['totalOffTime'] = $row['timeOff'];
if ($printable) {
- $data["time_s"] = self::formatSeconds($data["time"]);
- $data["medianTime_s"] = self::formatSeconds($data["medianTime"]);
- $data["totalOfftime_s"] = self::formatSeconds($data["totalOfftime"]);
+ $data["totalTime_s"] = self::formatSeconds($data["totalTime"]);
+ $data["medianSessionLength_s"] = self::formatSeconds($data["medianSessionLength"]);
+ $data["totalOffTime_s"] = self::formatSeconds($data["totalOffTime"]);
}
return $data;
@@ -40,22 +40,22 @@ class GetData
$res = Queries::getLocationStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$data = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $median = self::calcMedian(self::calcMedian($row['medianTime']));
+ $median = self::calcMedian(self::calcMedian($row['medianSessionLength']));
$entry = array(
'location' => ($anonymize ? $row['locHash'] : $row['locName']),
- 'time' => $row['timeSum'],
- 'medianTime' => $median,
- 'offTime' => $row['offlineSum'],
- 'sessions' => $row['longSessions'],
+ 'totalTime' => $row['timeSum'],
+ 'medianSessionLength' => $median,
+ 'totalOffTime' => $row['offlineSum'],
+ 'longSessions' => $row['longSessions'],
'shortSessions' => $row['shortSessions']
);
if (!$anonymize) {
$entry['locationId'] = $row['locId'];
}
if ($printable) {
- $entry['time_s'] = self::formatSeconds($row['timeSum']);
- $entry['medianTime_s'] = self::formatSeconds($median);
- $entry['offTime_s'] = self::formatSeconds($row['offlineSum']);
+ $entry['totalTime_s'] = self::formatSeconds($row['timeSum']);
+ $entry['medianSessionLength_s'] = self::formatSeconds($median);
+ $entry['totalOffTime_s'] = self::formatSeconds($row['offlineSum']);
}
$data[] = $entry;
}
@@ -69,15 +69,15 @@ class GetData
$res = Queries::getClientStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$data = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $median = self::calcMedian(self::calcMedian($row['medianTime']));
+ $median = self::calcMedian(self::calcMedian($row['medianSessionLength']));
$entry = array(
'hostname' => ($anonymize ? $row['clientHash'] : $row['clientName']),
- 'time' => $row['timeSum'],
- 'medianTime' => $median,
- 'offTime' => $row['offlineSum'],
+ 'totalTime' => $row['timeSum'],
+ 'medianSessionLength' => $median,
+ 'totalOffTime' => $row['offlineSum'],
'lastStart' => $row['lastStart'],
'lastLogout' => $row['lastLogout'],
- 'sessions' => $row['longSessions'],
+ 'longSessions' => $row['longSessions'],
'shortSessions' => $row['shortSessions'],
'location' => ($anonymize ? $row['locHash'] : $row['locName']),
);
@@ -85,11 +85,11 @@ class GetData
$entry['locationId'] = $row['locId'];
}
if ($printable) {
- $entry['time_s'] = self::formatSeconds($row['timeSum']);
- $entry['medianTime_s'] = self::formatSeconds($median);
- $entry['offTime_s'] = self::formatSeconds($row['offlineSum']);
- $entry['lastStart_s'] = date(DATE_RSS, $row['lastStart']);
- $entry['lastLogout_s'] = date(DATE_RSS, $row['lastLogout']);
+ $entry['totalTime_s'] = self::formatSeconds($row['timeSum']);
+ $entry['medianSessionLength_s'] = self::formatSeconds($median);
+ $entry['totalOffTime_s'] = self::formatSeconds($row['offlineSum']);
+ $entry['lastStart_s'] = date(DATE_ISO8601, $row['lastStart']);
+ $entry['lastLogout_s'] = date(DATE_ISO8601, $row['lastLogout']);
}
$data[] = $entry;
}
diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php
index 7a56414b..1d1d3a44 100644
--- a/modules-available/statistics_reporting/inc/queries.inc.php
+++ b/modules-available/statistics_reporting/inc/queries.inc.php
@@ -8,8 +8,8 @@ class Queries
public static function getClientStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) {
$notassigned = Dictionary::translate('notAssigned', true);
Database::exec("SET SESSION group_concat_max_len = 1000000000");
- $res = Database::simpleQuery("SELECT t1.name AS clientName, timeSum, medianTime, offlineSum, lastStart, lastLogout, longSessions, shortSessions, locId, locName, MD5(CONCAT(locId, :salt)) AS locHash, MD5(CONCAT(t1.uuid, :salt)) AS clientHash FROM (
- 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', IFNULL(location.locationname, '$notassigned') AS 'locName', location.locationid AS 'locId'
+ $res = Database::simpleQuery("SELECT t1.name AS clientName, timeSum, medianSessionLength, offlineSum, lastStart, lastLogout, longSessions, shortSessions, locId, locName, MD5(CONCAT(locId, :salt)) AS locHash, MD5(CONCAT(t1.uuid, :salt)) AS clientHash FROM (
+ SELECT machine.hostname AS 'name', machine.machineuuid AS 'uuid', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianSessionLength', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions',MAX(sessionTable.dateline + sessionTable.data) AS 'lastLogout', IFNULL(location.locationname, '$notassigned') AS 'locName', location.locationid AS 'locId'
FROM ".self::getBoundedTableQueryString('~session-length', $from, $to, $lowerTimeBound, $upperTimeBound)." sessionTable
INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid
LEFT JOIN location ON machine.locationid = location.locationid
@@ -30,8 +30,8 @@ class Queries
public static function getLocationStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) {
$notassigned = Dictionary::translate('notAssigned', true);
Database::exec("SET SESSION group_concat_max_len = 1000000000");
- $res = Database::simpleQuery("SELECT t1.locId, t1.locName AS locName, MD5(CONCAT(t1.locId, :salt)) AS locHash, timeSum, medianTime, offlineSum, longSessions, shortSessions FROM (
- SELECT IFNULL(location.locationname, '$notassigned') AS 'locName', location.locationid AS 'locId', 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'
+ $res = Database::simpleQuery("SELECT t1.locId, t1.locName AS locName, MD5(CONCAT(t1.locId, :salt)) AS locHash, timeSum, medianSessionLength, offlineSum, longSessions, shortSessions FROM (
+ SELECT IFNULL(location.locationname, '$notassigned') AS 'locName', location.locationid AS 'locId', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianSessionLength', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions'
FROM ".self::getBoundedTableQueryString('~session-length', $from, $to, $lowerTimeBound, $upperTimeBound)." sessionTable
INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid
LEFT JOIN location ON machine.locationid = location.locationid
diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html
index 2fb2f574..be504cef 100644
--- a/modules-available/statistics_reporting/templates/table-client.html
+++ b/modules-available/statistics_reporting/templates/table-client.html
@@ -17,11 +17,11 @@
<tr>
<td class="text-left">{{hostname}}</td>
<td class="text-left col_location"><a class="locationLink" href="#" data-lid="{{locationId}}">{{location}}</a></td>
- <td data-sort-value="{{time}}" class="text-left col_totalTime">{{time_s}}</td>
- <td data-sort-value="{{medianTime}}" class="text-left col_medianSessionLength">{{medianTime_s}}</td>
- <td class="text-left col_longSessions">{{sessions}}</td>
+ <td data-sort-value="{{totalTime}}" class="text-left col_totalTime">{{totalTime_s}}</td>
+ <td data-sort-value="{{medianSessionLength}}" class="text-left col_medianSessionLength">{{medianSessionLength_s}}</td>
+ <td class="text-left col_longSessions">{{longSessions}}</td>
<td class="text-left col_shortSessions">{{shortSessions}}</td>
- <td data-sort-value="{{offTime}}" class="text-left col_totalOffTime">{{offTime_s}}</td>
+ <td data-sort-value="{{totalOffTime}}" class="text-left col_totalOffTime">{{totalOffTime_s}}</td>
<td data-sort-value="{{lastLogout}}" class="text-left col_lastLogout">{{lastLogout_s}}</td>
<td data-sort-value="{{lastStart}}" class="text-left col_lastStart">{{lastStart_s}}</td>
</tr>
diff --git a/modules-available/statistics_reporting/templates/table-location.html b/modules-available/statistics_reporting/templates/table-location.html
index 9479b7af..ccac623d 100644
--- a/modules-available/statistics_reporting/templates/table-location.html
+++ b/modules-available/statistics_reporting/templates/table-location.html
@@ -13,11 +13,11 @@
{{#data}}
<tr{{#highlight}} class="info"{{/highlight}}>
<td class="locationName text-left">{{location}}</td>
- <td data-sort-value="{{time}}" class="text-left col_totalTime">{{time_s}}</td>
- <td data-sort-value="{{medianTime}}" class="text-left col_medianSessionLength">{{medianTime_s}}</td>
- <td class="text-left col_longSessions">{{sessions}}</td>
+ <td data-sort-value="{{totalTime}}" class="text-left col_totalTime">{{totalTime_s}}</td>
+ <td data-sort-value="{{medianSessionLength}}" class="text-left col_medianSessionLength">{{medianSessionLength_s}}</td>
+ <td class="text-left col_longSessions">{{longSessions}}</td>
<td class="text-left col_shortSessions">{{shortSessions}}</td>
- <td data-sort-value="{{offTime}}" class="text-left col_totalOffTime">{{offTime_s}}</td>
+ <td data-sort-value="{{totalOffTime}}" class="text-left col_totalOffTime">{{totalOffTime_s}}</td>
</tr>
{{/data}}
</tbody>
diff --git a/modules-available/statistics_reporting/templates/table-total.html b/modules-available/statistics_reporting/templates/table-total.html
index e59dda25..4048a178 100644
--- a/modules-available/statistics_reporting/templates/table-total.html
+++ b/modules-available/statistics_reporting/templates/table-total.html
@@ -12,11 +12,11 @@
<tbody>
<tr>
<th class="text-left">{{lang_total}}</th>
- <td class="text-left col_totalTime">{{data.time_s}}</td>
- <td class="text-left col_medianSessionLength">{{data.medianTime_s}}</td>
- <td class="text-left col_longSessions">{{data.sessions}}</td>
+ <td class="text-left col_totalTime">{{data.totalTime_s}}</td>
+ <td class="text-left col_medianSessionLength">{{data.medianSessionLength_s}}</td>
+ <td class="text-left col_longSessions">{{data.longSessions}}</td>
<td class="text-left col_shortSessions">{{data.shortSessions}}</td>
- <td class="text-left col_totalOffTime">{{data.totalOfftime_s}}</td>
+ <td class="text-left col_totalOffTime">{{data.totalOffTime_s}}</td>
</tr>
</tbody>
</table>