diff --git a/backend/routers/market_events.py b/backend/routers/market_events.py index fc07fef..d19a1f7 100644 --- a/backend/routers/market_events.py +++ b/backend/routers/market_events.py @@ -168,8 +168,9 @@ def list_events( sort_col = "me.impact_score" order_sql = f"ORDER BY {sort_col} {'DESC' if sort_dir == 'desc' else 'ASC'}" - # When joining with instrument_impacts an event can appear multiple times — use GROUP BY - group_sql = "GROUP BY me.id" if instrument else "" + # Always GROUP BY — the LEFT JOIN on instrument_impacts creates duplicate rows + # when an event has multiple impacts (one row per impact without GROUP BY) + group_sql = "GROUP BY me.id" # Extra columns: evaluated flag + optional instrument score evaluated_col = (