main
Deploy Iddaai Backend / build-and-deploy (push) Failing after 2m6s

This commit is contained in:
2026-05-12 02:43:02 +03:00
parent f8599bdb9a
commit b6d64b59bf
35 changed files with 1400 additions and 630 deletions
+8 -8
View File
@@ -78,9 +78,9 @@ class RefereePredictorEngine:
print("✅ RefereePredictorEngine initialized")
def predict(self,
match_id: str = None,
referee_name: str = None,
league_id: str = None) -> RefereePrediction:
match_id: Optional[str] = None,
referee_name: Optional[str] = None,
league_id: Optional[str] = None) -> RefereePrediction:
"""
Generate referee-based prediction.
@@ -95,21 +95,21 @@ class RefereePredictorEngine:
# Get referee features
if match_id:
features = self.referee_engine.get_features(match_id, league_id=league_id)
features = self.referee_engine.get_features(match_id, league_id=league_id or "")
# Live flows may already have referee_name while match_officials table is sparse.
# Prefer the richer profile if direct-name lookup has more history.
if referee_name:
name_features = self.referee_engine.get_features_by_name(referee_name, league_id=league_id)
name_features = self.referee_engine.get_features_by_name(referee_name, league_id=league_id or "")
if (name_features.get("referee_matches", 0) or 0) > (features.get("referee_matches", 0) or 0):
features = name_features
elif referee_name:
features = self.referee_engine.get_features_by_name(referee_name, league_id=league_id)
features = self.referee_engine.get_features_by_name(referee_name, league_id=league_id or "")
else:
# Return default
return RefereePrediction(confidence=10.0)
ref_name = features.get("referee_name", "Unknown")
matches = features.get("referee_matches", 0)
ref_name = str(features.get("referee_name", "Unknown"))
matches = int(features.get("referee_matches", 0))
if matches < 5:
# Not enough data