feat: desk ia
This commit is contained in:
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user