From d157d535a061915cd8fbd4448433b8116620ef5f Mon Sep 17 00:00:00 2001 From: Burathar Date: Fri, 10 Jul 2020 23:34:36 +0200 Subject: [PATCH] fix models.Player.last_location --- app/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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),