Browse Source

fix models.Player.last_location

feature_tests
Burathar 5 years ago
parent
commit
d157d535a0
  1. 2
      app/models.py

2
app/models.py

@ -148,7 +148,7 @@ class Player(UserMixin, db.Model): @@ -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),

Loading…
Cancel
Save