feat(zone): 三区标记M3后端——KPI values/bot-kpis响应补calculated_at时间字段(updated_at/value_updated_at/source_batch),供BotSourceTag展示 (three-zone P0-①)

This commit is contained in:
Hermes CI Fix
2026-09-03 17:52:36 +08:00
parent 92873456ab
commit a8de53a4c2
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -97,6 +97,9 @@ def list_bot_kpis(
"score": score,
"status": status,
"period": latest_val.period if latest_val else None,
# P0-① 三区标注: Bot KPI值最近回填时间/批次(UI BotSourceTag 消费)
"value_updated_at": latest_val.calculated_at.strftime("%Y-%m-%d %H:%M") if latest_val and latest_val.calculated_at else None,
"value_source_batch": latest_val.source_batch if latest_val else None,
"frequency": k.frequency or "monthly",
})
+4
View File
@@ -548,6 +548,8 @@ def list_kpi_values(
"source_batch": v.source_batch or "",
"data_status": v.data_status,
"remark": v.remark or "",
# P0-① 三区标注: C区Bot回填时间
"updated_at": v.calculated_at.strftime("%Y-%m-%d %H:%M") if v.calculated_at else None,
} for v in vals]
}
@@ -608,6 +610,8 @@ def get_kpi(kpi_id: int, db: Session = Depends(get_db), entity_id: int = Depends
"source_type": v.source_type,
"data_status": v.data_status,
"source_batch": v.source_batch,
# P0-① 三区标注: C区Bot回填时间(UI BotSourceTag 消费)
"updated_at": v.calculated_at.strftime("%Y-%m-%d %H:%M") if v.calculated_at else None,
})
return result