This commit is contained in:
@@ -108,6 +108,26 @@ class MarketBoardMixin:
|
||||
"hit": info.get("hit"),
|
||||
}
|
||||
|
||||
def _is_national_match(self, league_id: Optional[str]) -> bool:
|
||||
"""True if this league is an A-milli (senior men's) national competition."""
|
||||
if not league_id:
|
||||
return False
|
||||
natl = getattr(self, "national_leagues", None) or set()
|
||||
return str(league_id) in natl
|
||||
|
||||
def _competition_type_for(
|
||||
self, league_id: Optional[str], league_name: Optional[str]
|
||||
) -> Optional[str]:
|
||||
"""For national matches, classify HAZIRLIK/ELEME/TURNUVA from the league
|
||||
name. None for non-national leagues (clubs don't use this)."""
|
||||
if not self._is_national_match(league_id):
|
||||
return None
|
||||
try:
|
||||
from utils.national_leagues import classify_competition
|
||||
return classify_competition(league_name or "")
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def _build_prediction_package(
|
||||
self,
|
||||
data: MatchData,
|
||||
@@ -346,6 +366,9 @@ class MarketBoardMixin:
|
||||
# Backtest-derived per-league confidence (ROI + sample size).
|
||||
# None when the league has too little data to judge → FE shows no badge.
|
||||
"league_confidence": self._league_confidence_for(data.league_id),
|
||||
# National-team match flags (drive betting_brain's national gate).
|
||||
"is_national": self._is_national_match(data.league_id),
|
||||
"competition_type": self._competition_type_for(data.league_id, data.league_name),
|
||||
"match_date_ms": data.match_date_ms,
|
||||
"sport": data.sport,
|
||||
# Live snapshot — match_commentary uses this to detect upset-in-progress
|
||||
|
||||
Reference in New Issue
Block a user