Skip to content

Commit

Permalink
fixing this
Browse files Browse the repository at this point in the history
  • Loading branch information
day-mon committed Jan 20, 2024
1 parent 673adc4 commit 5fa59d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions api/api/business/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
)
Expand Down
5 changes: 5 additions & 0 deletions api/api/model/games/daily_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 5fa59d3

Please sign in to comment.