def get_game_history(self, request):
        """Get all history moves of a game"""
        game = get_by_urlsafe(request.urlsafe_game_key, Game)
        if not game:
            raise endpoints.NotFoundException('Game not found!')

        return HistoryForms(
            items=[history.to_form() for history in game.historys])
Пример #2
0
 def get_game_history(self, request):
     """Return game history for a specific game"""
     game = get_by_urlsafe(request.urlsafe_game_key, Game)
     if not game:
         raise endpoints.NotFoundException('Game not found!')
     gameHistory = GameHistory.query(GameHistory.game == game.key).get()
     return HistoryForms(
         items=[history.to_form() for history in gameHistory.histories])
Пример #3
0
    def get_game_history(self, request):
        """ get game history"""
        game = get_by_urlsafe(request.urlsafe_game_key, Game)

        if game.moves:
            history = []
            for m in game.moves:
                history.append(HistoryForm(move=m))
            return HistoryForms(moves=history)
Пример #4
0
 def get_game_history(self, request):
     """Return the game history."""
     game = get_by_urlsafe(request.urlsafe_game_key, Game)
     if game:
         histories = History.query(History.game==game.key).order(History.datetime)
         # histories = History.query(History.game==game.key)            
         return HistoryForms(items = [history.to_form() for history in histories])
     else:
         raise endpoints.NotFoundException('Game not found!')
Пример #5
0
 def get_game_history(self, request):
     """Return a game's history."""
     game = get_by_urlsafe(request.urlsafe_game_key, TicTac)
     if game:
         histories = History.query(History.game == game.key).\
                             order(History.steps)
         return HistoryForms(
             items=[history.to_form() for history in histories])
     else:
         raise endpoints.NotFoundException('Game not found!')
Пример #6
0
    def get_game_history(self, request):
        """Returns full history of a game"""
        game = get_by_urlsafe(request.urlsafe_game_key, Game)

        history_items = []

        for i in range(0, len(game.game_history)):
            history_items.append(game.to_history_form(i))

        return HistoryForms(items=history_items)
Пример #7
0
 def get_game_history(self, request):
     """Returns a history of all guesses made in game."""
     game = get_by_urlsafe(request.urlsafe_game_key, Game)
     if not game:
         raise endpoints.ConflictException(
             'Cannot find game with key {}'.format(
                 request.urlsafe_game_key))
     else:
         history = History.query(ancestor=game.key).order(History.order)
         return HistoryForms(items=[guess.to_form() for guess in history])
    def get_game_history(self, request):
        """Return game history."""
        game = get_by_urlsafe(request.urlsafe_game_key, Game)

        if game:
            # logging.info(game.history)
            items = []
            for history in game.history:
                items.append(
                    HistoryForm(sequence=history['seq'],
                                player=history['player'],
                                move=history['move'],
                                result=history['result']))
            # logging.info(items)
            return HistoryForms(items=items)
        else:
            raise endpoints.NotFoundException('Game not found!')