fix(lotto): curator_helpers 시그니처 정합 (recommender/analyzer/strategy_evolver 실제 시그니처에 맞춤)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,13 +102,15 @@ def check_purchases_for_draw(drw_no: int) -> int:
|
||||
def get_recent_performance(limit: int = 3) -> list:
|
||||
"""최근 N회차 내 구매 성과 요약. 없으면 빈 리스트."""
|
||||
from . import db
|
||||
purchases = db.get_purchases(days=None) or []
|
||||
purchases = db.get_purchases() or []
|
||||
by_draw: dict = {}
|
||||
for p in purchases:
|
||||
d = p.get("draw_no")
|
||||
if not d:
|
||||
continue
|
||||
by_draw.setdefault(d, {"draw_no": d, "purchased_sets": 0, "best_match": 0})
|
||||
by_draw[d]["purchased_sets"] += int(p.get("sets") or 1)
|
||||
by_draw[d]["best_match"] = max(by_draw[d]["best_match"], int(p.get("correct_count") or 0))
|
||||
results = p.get("results") or []
|
||||
max_correct = max((int(r.get("correct") or 0) for r in results), default=0)
|
||||
slot = by_draw.setdefault(d, {"draw_no": d, "purchased_sets": 0, "best_match": 0})
|
||||
slot["purchased_sets"] += int(p.get("sets") or 1)
|
||||
slot["best_match"] = max(slot["best_match"], max_correct)
|
||||
return sorted(by_draw.values(), key=lambda x: -x["draw_no"])[:limit]
|
||||
|
||||
Reference in New Issue
Block a user