feat(lotto): curator_helpers — 후보 병합·피처·맥락
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -97,3 +97,18 @@ def check_purchases_for_draw(drw_no: int) -> int:
|
||||
|
||||
logger.info(f"[purchase_manager] {drw_no}회차 구매 {count}건 체크 완료")
|
||||
return count
|
||||
|
||||
|
||||
def get_recent_performance(limit: int = 3) -> list:
|
||||
"""최근 N회차 내 구매 성과 요약. 없으면 빈 리스트."""
|
||||
from . import db
|
||||
purchases = db.get_purchases(days=None) 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))
|
||||
return sorted(by_draw.values(), key=lambda x: -x["draw_no"])[:limit]
|
||||
|
||||
Reference in New Issue
Block a user