summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruser <user@node5.net>2024-03-26 16:17:43 +0100
committeruser <user@node5.net>2024-03-26 16:17:43 +0100
commit3d5575393bcd4214dae0d1c1c27c770cae57d324 (patch)
treeeb6b04bc550cf5c061f5a014f7d42e153f98c630
parent3304f879939cc851650040c21b5ce8a93140c8c5 (diff)
chart - show latest data, even if older than 2 days
-rw-r--r--src/db_handler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/db_handler.py b/src/db_handler.py
index 7a436e6..4d834e8 100644
--- a/src/db_handler.py
+++ b/src/db_handler.py
@@ -63,7 +63,7 @@ def get_histogram_detailed() -> str:
SELECT count(la.id) as total_count, date_trunc('hour', la.timestamp) as date, cn.ip
FROM login_attempt la
JOIN connection cn on cn.id = la.connection
-WHERE la.timestamp BETWEEN current_timestamp - interval '2 days' AND la.timestamp
+WHERE la.timestamp BETWEEN (select max(timestamp) from login_attempt) - interval '2 days' AND (select max(timestamp) from login_attempt)
GROUP BY date_trunc('hour', la.timestamp), cn.ip
ORDER BY COUNT(la.id) DESC
;