Skip to content

Commit 9defb93

Browse files
committed
Fix status flickering when a game is postponed
1 parent b529f9d commit 9defb93

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

data/game.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ def update(self, force=False, testing_params={}) -> UpdateStatus:
7474
# it will recycle that data until the queue is full.
7575
self._data_wait_queue.push(live_data)
7676
self._current_data = self._data_wait_queue.peek()
77-
self._status = self._current_data["gameData"]["status"]
77+
78+
# this is odd, but if a game is postponed then the 'game' endpoint gets the
79+
# rescheduled game, so we need to check the schedule endpoint instead
7880
if live_data["gameData"]["datetime"]["officialDate"] > self.date:
79-
# this is odd, but if a game is postponed then the 'game' endpoint gets the rescheduled game
8081
LOGGER.debug("Getting game status from schedule for game with strange date!")
8182
try:
8283
scheduled = statsapi.get(
@@ -89,6 +90,8 @@ def update(self, force=False, testing_params={}) -> UpdateStatus:
8990
)
9091
except:
9192
LOGGER.error("Failed to get game status from schedule")
93+
else:
94+
self._status = self._current_data["gameData"]["status"]
9295

9396
self._uniform_data.update()
9497
self.print_game_data_debug()

0 commit comments

Comments
 (0)