fix: filter session count sums by created_at (#6529)

Fixes the session totals being waaaaay too high!
This commit is contained in:
Kyle Carberry
2023-03-09 17:08:41 +02:00
committed by GitHub
parent 1cc10f2ffb
commit 70b093ff2a
2 changed files with 2 additions and 2 deletions
@@ -70,7 +70,7 @@ WITH agent_stats AS (
coalesce(SUM(session_count_reconnecting_pty), 0)::bigint AS session_count_reconnecting_pty
FROM (
SELECT *, ROW_NUMBER() OVER(PARTITION BY agent_id ORDER BY created_at DESC) AS rn
FROM workspace_agent_stats
FROM workspace_agent_stats WHERE created_at > $1
) AS a WHERE a.rn = 1
)
SELECT * FROM agent_stats, latest_agent_stats;