Esempio n. 1
0
 def __now__(self):
     ''' Returns snapshot object it as a dict '''
     snapshot = Snapshot()
     for team in Team.all():
         snapshot_team = SnapshotTeam(
             team_id=team.id,
             money=team.money,
         )
         snapshot_team.game_levels = team.game_levels
         snapshot_team.flags = team.flags
         dbsession.add(snapshot_team)
         dbsession.flush()
         snapshot.teams.append(snapshot_team)
     dbsession.add(snapshot)
     dbsession.flush()
     return snapshot
Esempio n. 2
0
 def __now__(self):
     ''' Returns snapshot object it as a dict '''
     snapshot = Snapshot()
     bot_manager = BotManager.Instance()
     for team in Team.all():
         snapshot_team = SnapshotTeam(team_id=team.id,
                                      money=team.money,
                                      bots=bot_manager.count_by_team(team))
         snapshot_team.game_levels = team.game_levels
         snapshot_team.flags = team.flags
         dbsession.add(snapshot_team)
         dbsession.flush()
         snapshot.teams.append(snapshot_team)
     dbsession.add(snapshot)
     dbsession.flush()
     return snapshot