Skip to content

Commit

Permalink
Avoid warning if no team rank is available
Browse files Browse the repository at this point in the history
  • Loading branch information
kloemi committed Jul 27, 2024
1 parent dc08742 commit 26a8d27
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/samsvolleyball/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ def fill_team_attributes(attrs, data, team, state):
try:
_, league = get_team(data, team[ID])
rank_team = _get_ranking(league, team[ID])
attrs[
"team_record"
] = f"{rank_team['scoreDetails']['matchesPlayed']} - {rank_team['scoreDetails']['winScore']}"
attrs["team_rank"] = rank_team["rankingPosition"]
if rank_team:
attrs[
"team_record"
] = f"{rank_team['scoreDetails']['matchesPlayed']} - {rank_team['scoreDetails']['winScore']}"
attrs["team_rank"] = rank_team["rankingPosition"]
attrs["league"] = league[NAME]
attrs["last_update"] = dt_util.as_local(dt_util.now())

Expand Down

0 comments on commit 26a8d27

Please sign in to comment.