fix(lotto): Phase 3 리뷰 반영 (run-forward 백그라운드·review 404·track_record distinct·테스트 보강)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 17:30:10 +09:00
parent 74f385c7bd
commit add433233a
5 changed files with 73 additions and 7 deletions

View File

@@ -207,6 +207,7 @@ def track_record() -> Dict[str, Any]:
db = _db()
rows = db.get_backtest_runs()
agg: Dict[str, Dict[str, int]] = {}
draw_sets: Dict[str, set] = {}
for r in rows:
a = agg.setdefault(r["strategy"], {
"n_tickets": 0, "1st": 0, "2nd": 0, "3rd": 0, "4th": 0, "5th": 0, "draws": 0})
@@ -214,7 +215,9 @@ def track_record() -> Dict[str, Any]:
a["n_tickets"] += r["n_tickets"]
for tier in ("1st", "2nd", "3rd", "4th", "5th"):
a[tier] += p[tier]
a["draws"] += 1
draw_sets.setdefault(r["strategy"], set()).add(r["draw_no"])
for strat, s in draw_sets.items():
agg[strat]["draws"] = len(s)
return {"by_strategy": agg}