diff --git a/app/models.py b/app/models.py index 238a904..7a939e2 100644 --- a/app/models.py +++ b/app/models.py @@ -148,7 +148,7 @@ class Player(UserMixin, db.Model): if not self.locations: return None if game is None: - return max(location for location in self.locations) + return max((location for location in self.locations), key=lambda location: location.timestamp) game_start = game.start_time or datetime.min game_end = game.end_time or datetime.max return max((location for location in self.locations if location.timestamp > game_start and location.timestamp < game_end),