fix: 代码审查问题修复
- unit_of_work.py: 简化为纯 session 上下文管理器,消除 double-close 风险 - validation.py: 移除未使用的 import,简化 _score_to_1x2 逻辑 - repositories.py: 将 func 导入移到模块顶层 - 更新所有 get_uow() 调用点使用新接口(yield session 而非 uow 对象)
This commit is contained in:
+2
-2
@@ -108,9 +108,9 @@ async def run_backtest(
|
||||
Returns:
|
||||
BacktestSummary 含逐场结果 + 汇总统计
|
||||
"""
|
||||
async with get_uow() as uow:
|
||||
async with get_uow() as session:
|
||||
matches = await _get_historical_matches(
|
||||
uow.session, league_id=league_id, date_from=date_from, date_to=date_to, limit=limit
|
||||
session, league_id=league_id, date_from=date_from, date_to=date_to, limit=limit
|
||||
)
|
||||
|
||||
summary = BacktestSummary(total=len(matches), scored=0)
|
||||
|
||||
Reference in New Issue
Block a user