|
|
|
@ -93,7 +93,8 @@ class Game(db.Model):
@@ -93,7 +93,8 @@ class Game(db.Model):
|
|
|
|
|
locations.append(player.last_location(self)) |
|
|
|
|
return locations |
|
|
|
|
|
|
|
|
|
def owned_by(self, player): |
|
|
|
|
def owned_by(self, player): |
|
|
|
|
# pylint: disable=not-an-iterable |
|
|
|
|
'''given player is an owner of game''' |
|
|
|
|
return player in [gameplayer.player for gameplayer in self.game_players if gameplayer.role == Role.owner] |
|
|
|
|
|
|
|
|
@ -182,7 +183,7 @@ class Player(UserMixin, db.Model):
@@ -182,7 +183,7 @@ class Player(UserMixin, db.Model):
|
|
|
|
|
return None |
|
|
|
|
return gameplayers[0].role |
|
|
|
|
|
|
|
|
|
def owns_game_played_by(self, player): |
|
|
|
|
def owns_game_played_by(self, player): |
|
|
|
|
'''self is an owner of a game the player participates in''' |
|
|
|
|
return self in [gameplayer.player for gameplayers in |
|
|
|
|
[game.game_players for game in player.games] |
|
|
|
|