|
|
|
@ -42,7 +42,7 @@ class User(UserMixin, db.Model):
@@ -42,7 +42,7 @@ class User(UserMixin, db.Model):
|
|
|
|
|
return False |
|
|
|
|
return check_password_hash(self.password_hash, password) |
|
|
|
|
|
|
|
|
|
def locations_during_game(self, game, offset=0): |
|
|
|
|
def locations_during_game(self, game, offset=None): |
|
|
|
|
''' |
|
|
|
|
Returns users locations during game. |
|
|
|
|
|
|
|
|
@ -51,6 +51,8 @@ class User(UserMixin, db.Model):
@@ -51,6 +51,8 @@ class User(UserMixin, db.Model):
|
|
|
|
|
offset (int): Offset in minutes. Only locations older than this amount of minutes will be returned. |
|
|
|
|
''' |
|
|
|
|
# pylint: disable=not-an-iterable |
|
|
|
|
if offset is None: |
|
|
|
|
offset = 0 |
|
|
|
|
if not self.locations: |
|
|
|
|
return None |
|
|
|
|
if game is None: |
|
|
|
@ -67,7 +69,7 @@ class User(UserMixin, db.Model):
@@ -67,7 +69,7 @@ class User(UserMixin, db.Model):
|
|
|
|
|
if location.timestamp > game_start and location.timestamp < game_end |
|
|
|
|
and datetime.utcnow() - location.timestamp > timedelta(minutes=offset)] |
|
|
|
|
|
|
|
|
|
def last_location(self, game=None, offset=0): |
|
|
|
|
def last_location(self, game=None, offset=None): |
|
|
|
|
''' |
|
|
|
|
Returns users last recorded location. |
|
|
|
|
|
|
|
|
@ -76,6 +78,8 @@ class User(UserMixin, db.Model):
@@ -76,6 +78,8 @@ class User(UserMixin, db.Model):
|
|
|
|
|
offset (int): Offset in minutes. Only locations older than this amount of minutes will be returned. |
|
|
|
|
''' |
|
|
|
|
# pylint: disable=[not-an-iterable, unsubscriptable-object] |
|
|
|
|
if offset is None: |
|
|
|
|
offset = 0 |
|
|
|
|
if not self.locations: |
|
|
|
|
return None |
|
|
|
|
if game is None: |
|
|
|
|