diff --git a/sage_datamart/init.py b/sage_datamart/init.py index cf273f1..e59e559 100644 --- a/sage_datamart/init.py +++ b/sage_datamart/init.py @@ -81,7 +81,10 @@ async def api_provider_roi(sor, params_kw=None): try: model = (params_kw or {}).get('model') stat_date = (params_kw or {}).get('date') - sql = "SELECT * FROM dm_provider_cost_daily WHERE 1=1" + sql = """SELECT p.*, COALESCE(o.orgname, p.providerid) as provider_name + FROM dm_provider_cost_daily p + LEFT JOIN organization o ON o.id = p.providerid + WHERE 1=1""" ns = {} if stat_date: sql += " AND stat_date=${stat_date}$" diff --git a/wwwroot/sect_provider_roi.ui b/wwwroot/sect_provider_roi.ui index b895b4b..c07a5e0 100644 --- a/wwwroot/sect_provider_roi.ui +++ b/wwwroot/sect_provider_roi.ui @@ -3,7 +3,7 @@ "options": { "height": "240px", "data_url": "/sage_datamart/api/provider_roi.dspy", - "nameField": "model", + "nameField": "provider_name", "xField": "unit_price", "yField": "avg_ttft_ms", "sizeField": "total_calls"