diff --git a/the_hunt.py b/the_hunt.py index fb91633..fa47d34 100755 --- a/the_hunt.py +++ b/the_hunt.py @@ -9,4 +9,29 @@ def make_shell_context(): return {'db': db, 'Game' : Game, 'Player' : Player, 'Objective' : Objective, 'Location' : Location, 'Notification' : Notification, 'GamePlayer' : GamePlayer, 'PlayerFoundObjective' : PlayerFoundObjective, 'NotificationPlayer' : NotificationPlayer, - 'PlayerCaughtPlayer' : PlayerCaughtPlayer, 'Role' : Role, 'GameState' : GameState} \ No newline at end of file + 'PlayerCaughtPlayer' : PlayerCaughtPlayer, 'Role' : Role, 'GameState' : GameState, + 'create_objects' : create_objects} + +def create_objects(): + g1 = Game(name='TestGame') + g2 = Game(name='MyGame') + + p1 = Player(name='Marijn') + p2 = Player(name='Rogier') + p3 = Player(name='Henk') + p4 = Player(name='Emma') + p5 = Player(name='Demi') + + g1.game_players.append(GamePlayer(player=p1, role=Role.owner)) + g1.game_players.append(GamePlayer(player=p2, role=Role.hunter)) + g1.game_players.append(GamePlayer(player=p3, role=Role.hunter)) + g1.game_players.append(GamePlayer(player=p4, role=Role.bunny)) + g1.game_players.append(GamePlayer(player=p5, role=Role.bunny)) + + g2.game_players.append(GamePlayer(player=p1, role=Role.bunny)) + g2.game_players.append(GamePlayer(player=p2, role=Role.owner)) + g2.game_players.append(GamePlayer(player=p3, role=Role.hunter)) + + db.session.add(g1) + db.session.add(g2) + db.session.commit() \ No newline at end of file