Skip to content

Commit

Permalink
fix(nbagt): error when next game is exhibition game
Browse files Browse the repository at this point in the history
ver(nbagt): 1.1.3
ver(platform): 2024.9.5
  • Loading branch information
toddrob99 committed Sep 24, 2024
1 parent ee0a8ac commit 84ca664
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bots/nba_game_threads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import praw

__version__ = "1.1.2"
__version__ = "1.1.3"

DATA_LOCK = threading.Lock()

Expand Down
12 changes: 11 additions & 1 deletion bots/nba_game_threads/templates/next_game.mako
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
return
if not data["next_game"].away_team.team_id or not data["next_game"].home_team.team_id:
return
home_sub = data['teamSubsById'].get(data['next_game'].home_team.team_id)
if home_sub:
home_sub_link = f"[{data['next_game'].home_team.team_city} {data['next_game'].home_team.team_name}]({home_sub})"
else:
home_sub_link = f"{data['next_game'].home_team.team_city} {data['next_game'].home_team.team_name}"
away_sub = data['teamSubsById'].get(data['next_game'].away_team.team_id)
if away_sub:
away_sub_link = f"[{data['next_game'].away_team.team_city} {data['next_game'].away_team.team_name}]({away_sub})"
else:
away_sub_link = f"{data['next_game'].away_team.team_city} {data['next_game'].away_team.team_name}"
team_timezone = settings.get("Bot", {}).get("TEAM_TIMEZONE", "America/New_York")
game_datetime = convert_timezone( # Convert Zulu to my team TZ
datetime.strptime(
Expand All @@ -25,7 +35,7 @@
%>
${'##'} Next ${data["myTeam"].team_info.team_name} Game
${formatted_date_time} \
${f"@ [{data['next_game'].home_team.team_city} {data['next_game'].home_team.team_name}]({data['teamSubsById'][data['next_game'].home_team.team_id]})" if data['next_game'].away_team.team_id == data["myTeam"].team_info.team_id else f"vs. [{data['next_game'].away_team.team_city} {data['next_game'].away_team.team_name}]({data['teamSubsById'][data['next_game'].away_team.team_id]})"} \
${f"@ {home_sub_link}" if data['next_game'].away_team.team_id == data["myTeam"].team_info.team_id else f"vs. {away_sub_link}"} \
% if days_til_next_game > 0:
(${days_til_next_game} day${'s' if days_til_next_game > 1 else ''})
% endif
2 changes: 1 addition & 1 deletion redball/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python

VERSION = "2024.9.4"
VERSION = "2024.9.5"

0 comments on commit 84ca664

Please sign in to comment.