diff --git a/api/api/business/model.py b/api/api/business/model.py index 51d8c07..f4ffaab 100644 --- a/api/api/business/model.py +++ b/api/api/business/model.py @@ -97,9 +97,10 @@ async def predict(self, data: DataFrame, games: list[DailyGame]) -> list[Predict predicts: list[Prediction] = [] for index, (prediction, confidence) in enumerate(zip(predictions, confidences)): logger.debug(f"Prediction: {prediction}") - corresponding_game = next((game for game in games if game.home_team.name == di[index]["home_team"] or game.away_team.name == di[index]["away_team"]), None) + corresponding_game = next((game for game in games if game.home_team.full_name == di[index]["home_team"] or game.away_team.full_name == di[index]["away_team"]), None) if corresponding_game is None: - logger.error(f"Unable to find game for {prediction.game_id}") + logger.debug(f"GAMES: {games}") + logger.error(f"Unable to find game for {di[index]['home_team']} vs {di[index]['away_team']}") continue predicts.append( @@ -241,8 +242,8 @@ async def predict(self, data: DataFrame, games: list[DailyGame]) -> list[Predict ( game for game in games - if game.home_team.name == team_name - or game.away_team.name == team_name + if game.home_team.full_name == team_name + or game.away_team.full_name == team_name ), None, ) diff --git a/api/api/model/games/daily_game.py b/api/api/model/games/daily_game.py index 1164f18..e81ab34 100644 --- a/api/api/model/games/daily_game.py +++ b/api/api/model/games/daily_game.py @@ -176,6 +176,11 @@ class TeamData(BaseModel): seed: Optional[int | str] = None leader: Optional[PlayerLeader] = None + + @property + def full_name(self) -> str: + return f"{self.city} {self.name}" + class Score(BaseModel): points: int periods: list[Period]