feat(query): include session totals and stable framework names

This commit is contained in:
William Valentin
2026-05-20 17:35:56 -07:00
parent db73eca6fd
commit 78376bdd83
5 changed files with 82 additions and 3 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ func (d *DB) GetSummary(ctx context.Context) (*Summary, error) {
WITH session_groups AS (
SELECT
session_id,
COALESCE(MAX(source_framework), 'unknown') AS framework,
COALESCE((ARRAY_AGG(source_framework ORDER BY CASE WHEN type = 'session.start' THEN 0 ELSE 1 END, ts) FILTER (WHERE source_framework IS NOT NULL))[1], 'unknown') AS framework,
MAX(ts) AS last_event_at,
BOOL_OR(type = 'session.start') AS has_start,
BOOL_OR(type = 'session.end') AS has_end