Skip to content

Commit

Permalink
Merge pull request #8 from tylerbrawl/docs
Browse files Browse the repository at this point in the history
Fixed an issue with getting the user's play time (v0.1.3).
  • Loading branch information
tylerbrawl committed Dec 11, 2019
2 parents 5ff1849 + 570efa9 commit aa6bc5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/galaxyutils/__init__.py
@@ -1,3 +1,3 @@
__author__ = "Tyler Nichols"
__license__ = "MIT"
__version__ = "0.1.2"
__version__ = "0.1.3"
7 changes: 4 additions & 3 deletions src/galaxyutils/time_tracker.py
Expand Up @@ -95,8 +95,6 @@ def check_game_status(self, game_id):
"""
self._update_tracked_time(game_id)
if game_id not in self._running_games_dict:
raise GameNotTrackedException
del self._running_games_dict[game_id]

def _update_tracked_time(self, game_id: str) -> None:
Expand Down Expand Up @@ -126,7 +124,10 @@ async def get_game_time(self, game_id, context):
"""
if game_id not in self._game_time_cache:
raise GameNotTrackedException
self._update_tracked_time(game_id)
# The tracked time should only be updated if the game is running; otherwise, a GameNotTrackedException is
# erroneously thrown.
if game_id in self._running_games_dict:
self._update_tracked_time(game_id)
time_played = self._game_time_cache[game_id]['time_played']
current_time = self._game_time_cache[game_id]['last_played']
return GameTime(game_id, time_played=int(time_played), last_played_time=int(current_time))
Expand Down

0 comments on commit aa6bc5e

Please sign in to comment.