fix: 统计日历服务端内嵌 bootstrap,首屏显示盈亏与笔数

与月统计同源 initial_calendar 写入页面,API 失败时仍渲染;四所日历路由独立注册并传入 get_db_fn。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-30 09:13:58 +08:00
parent 4f784d09ac
commit 3b687d17eb
15 changed files with 195 additions and 53 deletions
+2 -1
View File
@@ -92,6 +92,7 @@ def register_trade_stats_calendar_route(
load_pnls_fn,
row_matches_segment_fn,
reset_hour: int,
get_db_fn=None,
):
"""四所统计分析页:按月返回各交易日盈亏/笔数。"""
from flask import jsonify, request
@@ -110,7 +111,7 @@ def register_trade_stats_calendar_route(
now = datetime.now()
year = year or now.year
month = month or now.month
get_db = (app.config.get("HUB_CTX") or {}).get("get_db")
get_db = get_db_fn or (app.config.get("HUB_CTX") or {}).get("get_db")
if not get_db:
return jsonify({"ok": False, "msg": "未配置数据库"}), 500
conn = get_db()