Skip to content

Commit

Permalink
Fix offline_game_model update ordering #33
Browse files Browse the repository at this point in the history
The base model update method was being called before we report the game
has ended. This caused a delay in reporting of the game over status.
  • Loading branch information
trevorbayless committed Nov 29, 2024
1 parent dd77ae8 commit 0051ccb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli_chess/core/game/offline_game/offline_game_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ def update(self, *args, **kwargs) -> None:
listens to subscribed model update events and if deemed necessary
triages and notifies listeners of the event.
"""
super().update(*args, **kwargs)
if EventTopics.GAME_END in args:
self._report_game_over()

super().update(*args, **kwargs)

def make_move(self, move: str):
"""Sends the move to the board model for it to be made"""
if self.game_in_progress:
Expand Down

0 comments on commit 0051ccb

Please sign in to comment.