diff --git a/web/src/beanflows/dashboard/routes.py b/web/src/beanflows/dashboard/routes.py index c82fca7..c2bea3a 100644 --- a/web/src/beanflows/dashboard/routes.py +++ b/web/src/beanflows/dashboard/routes.py @@ -100,7 +100,7 @@ async def index(): # Fetch all analytics data in parallel (empty lists/None if DB not available) if analytics._conn is not None: - time_series, top_producers, stu_trend, balance, yoy, cot_latest, cot_trend = await asyncio.gather( + results = await asyncio.gather( analytics.get_global_time_series( analytics.COFFEE_COMMODITY_CODE, ["production", "exports", "imports", "ending_stocks", "total_distribution"], @@ -111,7 +111,12 @@ async def index(): analytics.get_production_yoy_by_country(analytics.COFFEE_COMMODITY_CODE, limit=15), analytics.get_cot_positioning_latest(analytics.COFFEE_CFTC_CODE), analytics.get_cot_index_trend(analytics.COFFEE_CFTC_CODE, weeks=104), + return_exceptions=True, ) + time_series, top_producers, stu_trend, balance, yoy, cot_latest, cot_trend = [ + r if not isinstance(r, Exception) else (None if i == 5 else []) + for i, r in enumerate(results) + ] else: time_series, top_producers, stu_trend, balance, yoy = [], [], [], [], [] cot_latest, cot_trend = None, []