fix: remove nested aggregate in claim_strength materialized view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-04-13 18:48:58 -04:00
parent e1ab6e4ad1
commit 537f01770c
1 changed files with 5 additions and 4 deletions

View File

@ -78,10 +78,11 @@ SELECT
NULLIF(COUNT(DISTINCT a.id)::float, 0), NULLIF(COUNT(DISTINCT a.id)::float, 0),
0 0
) AS net_sentiment, ) AS net_sentiment,
MAX(GREATEST( GREATEST(
COALESCE(MAX(a.created_at), c.created_at), MAX(a.created_at),
COALESCE(MAX(e.created_at), c.created_at) MAX(e.created_at),
)) AS last_activity c.created_at
) AS last_activity
FROM claims c FROM claims c
LEFT JOIN attestations a ON a.claim_id = c.id LEFT JOIN attestations a ON a.claim_id = c.id
LEFT JOIN evidence e ON e.claim_id = c.id LEFT JOIN evidence e ON e.claim_id = c.id