feat: desk ia

This commit is contained in:
OpenSquared
2026-06-29 19:50:18 +02:00
parent f7acca2152
commit 551ebc3ef4
2 changed files with 12 additions and 5 deletions

View File

@@ -544,13 +544,18 @@ def _get_relevant_events(
(SELECT GROUP_CONCAT(DISTINCT a.instrument)
FROM causal_event_analyses a
WHERE a.market_event_id = e.id) AS analyzed_instruments,
(SELECT a.template_id FROM causal_event_analyses a WHERE a.market_event_id = e.id ORDER BY a.id DESC LIMIT 1) AS template_id,
(SELECT a.template_id FROM causal_event_analyses a WHERE a.market_event_id = e.id ORDER BY a.id DESC LIMIT 1) AS cea_template_id,
(SELECT a.id FROM causal_event_analyses a WHERE a.market_event_id = e.id ORDER BY a.id DESC LIMIT 1) AS analysis_id
FROM market_events e
ORDER BY e.start_date DESC
""").fetchall()
conn.close()
all_events = [dict(r) for r in rows]
# Use cea_template_id (from causal_event_analyses) explicitly to avoid
# any collision with an e.* column named template_id
all_events = [
{**dict(r), "template_id": r["cea_template_id"]}
for r in rows
]
except Exception as e:
logger.warning(f"[instrument_service] Could not load market events: {e}")
return []