From 406cd79ff35ab1dd3ba796207f2ea471e87f17d5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 4 Jan 2018 18:34:28 +0100 Subject: [statistics_reporting] Query rewrite: Use iterative approach Several simple test cases yielded incorrect results, also sessions partially overlapping with the selected hours were not handled properly. Iterative processing of logged events instead of single humongous unmaintainable SQL query. --- .../templates/table-client.html | 50 ++++++++++++++-------- .../templates/table-location.html | 40 +++++++++++------ .../templates/table-total.html | 40 +++++++++++------ 3 files changed, 86 insertions(+), 44 deletions(-) (limited to 'modules-available/statistics_reporting/templates') diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html index 59153e01..a23c2f89 100644 --- a/modules-available/statistics_reporting/templates/table-client.html +++ b/modules-available/statistics_reporting/templates/table-client.html @@ -1,29 +1,43 @@ - +
- - - - - - - - - + + + + + + + + + + + + + + + + {{#data}} - - - - - - - - + + + + + + + + + + + + + + + {{/data}} diff --git a/modules-available/statistics_reporting/templates/table-location.html b/modules-available/statistics_reporting/templates/table-location.html index a0867208..4e470d1e 100644 --- a/modules-available/statistics_reporting/templates/table-location.html +++ b/modules-available/statistics_reporting/templates/table-location.html @@ -1,23 +1,37 @@ -
{{lang_hostname}}{{lang_location}}{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}{{lang_lastLogout}}{{lang_lastStart}}{{lang_hostname}}{{lang_location}}{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}(%){{lang_totalStandbyTime}}(%){{lang_totalSessionTime}}(%){{lang_totalIdleTime}}(%){{lang_lastLogout}}{{lang_lastStart}}
{{hostname}}{{location}}{{totalTime_s}}{{medianSessionLength_s}}{{longSessions}}{{shortSessions}}{{totalOffTime_s}}{{lastLogout_s}}{{lastStart_s}}{{locationname}}{{totalTime_s}}{{medianSessionLength_s}}{{longSessions}}{{shortSessions}}{{totalOffTime_s}}{{totalOffTime_p}} %{{totalStandbyTime_s}}{{totalStandbyTime_p}} %{{totalSessionTime_s}}{{totalSessionTime_p}} %{{totalIdleTime_s}}{{totalIdleTime_p}} %{{lastLogout_s}}{{lastStart_s}}
+
- - - - - - + + + + + + + + + + + + + {{#data}} - - - - - - + + + + + + + + + + + + + {{/data}} diff --git a/modules-available/statistics_reporting/templates/table-total.html b/modules-available/statistics_reporting/templates/table-total.html index 8d5d7571..83078714 100644 --- a/modules-available/statistics_reporting/templates/table-total.html +++ b/modules-available/statistics_reporting/templates/table-total.html @@ -1,22 +1,36 @@ -
{{lang_location}}{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}{{lang_location}}{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}(%){{lang_totalStandbyTime}}(%){{lang_totalSessionTime}}(%){{lang_totalIdleTime}}(%)
{{location}}{{totalTime_s}}{{medianSessionLength_s}}{{longSessions}}{{shortSessions}}{{totalOffTime_s}}{{locationname}}{{totalTime_s}}{{medianSessionLength_s}}{{longSessions}}{{shortSessions}}{{totalOffTime_s}}{{totalOffTime_p}} %{{totalStandbyTime_s}}{{totalStandbyTime_p}} %{{totalSessionTime_s}}{{totalSessionTime_p}} %{{totalIdleTime_s}}{{totalIdleTime_p}} %
+
- - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + +
{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}(%){{lang_totalStandbyTime}}(%){{lang_totalSessionTime}}(%){{lang_totalIdleTime}}(%)
{{lang_total}}{{data.totalTime_s}}{{data.medianSessionLength_s}}{{data.longSessions}}{{data.shortSessions}}{{data.totalOffTime_s}}{{lang_total}}{{data.totalTime_s}}{{data.medianSessionLength_s}}{{data.longSessions}}{{data.shortSessions}}{{data.totalOffTime_s}}{{data.totalOffTime_p}} %{{data.totalStandbyTime_s}}{{data.totalStandbyTime_p}} %{{data.totalSessionTime_s}}{{data.totalSessionTime_p}} %{{data.totalIdleTime_s}}{{data.totalIdleTime_p}} %
-- cgit v1.2.3-55-g7522