def get(self):
        year, month, week, day = dateutils.get_datetime_data(datetime.datetime.now())
        
        gameKey = cgi.escape(self.request.get('gameKey'))
        range = self.request.get('range')
        
        game = Game.all().filter("gameKey =", gameKey ).get()
        
        tags = self.request.get_all('tag')        
        limit = self.request.get_range('limit', 1000)
        
        distinct  = self.request.get('distinct', "true")
        distinct = False if distinct == "false" else True 
        
        # scores = game.scores
        
        rangeNumber  = self.request.get_range('rangeNumber')
        
        scores = scoreDao.get_scores(game, range, tags, "-points", limit, year, month, week, day, rangeNumber, distinct)
        
        template_values = {'game':game, 'scores':scores}

        path = os.path.join(os.path.dirname(__file__), 'game.html')
        self.response.headers['Content-Type'] = 'text/html'
        self.response.out.write(template.render(path, template_values))
Beispiel #2
0
    def get(self):
        year, month, week, day = dateutils.get_datetime_data(
            datetime.datetime.now())

        gameKey = cgi.escape(self.request.get('gameKey'))
        range = self.request.get('range')

        game = Game.all().filter("gameKey =", gameKey).get()

        tags = self.request.get_all('tag')
        limit = self.request.get_range('limit', 1000)

        distinct = self.request.get('distinct', "true")
        distinct = False if distinct == "false" else True

        # scores = game.scores

        rangeNumber = self.request.get_range('rangeNumber')

        scores = scoreDao.get_scores(game, range, tags, "-points", limit, year,
                                     month, week, day, rangeNumber, distinct)

        template_values = {'game': game, 'scores': scores}

        path = os.path.join(os.path.dirname(__file__), 'game.html')
        self.response.headers['Content-Type'] = 'text/html'
        self.response.out.write(template.render(path, template_values))
Beispiel #3
0
    def get(self):
        gameKey = cgi.escape(self.request.get('gameKey'))
        game = Game.all().filter("gameKey =", gameKey).get()
        
        if(not game):
            self.response.set_status(500, message="Can't find game with key " + gameKey)
            return
        
        range = self.request.get('range')
        tags = self.request.get_all('tag')        
        limit = self.request.get_range('limit')
        ascending = self.request.get('ascending')
        
        distinct  = self.request.get('distinct', "true")
        distinct = False if distinct == "false" else True 
                
        if(ascending == "true"):
            order = "points"
        else:
            order = "-points"
        
        rangeNumber  = self.request.get_range('rangeNumber')
         
        year, month, week, day = dateutils.get_datetime_data(datetime.datetime.now())
        scores = scoreDao.get_scores(game, range, tags, order, limit, year, month, week, day, rangeNumber, distinct)

        self.response.headers['Content-Type'] = 'text/plain'
        scoreList = []
        for score in scores:
            data = json.loads(score.data)
            scoreData = {'id': str(score.key()), 'profilePublicKey': score.profilePublicKey, 'name': score.name, 'tags':score.tags, 'points':score.points, 'timestamp':long(time.mktime(score.timestamp.timetuple())*1000), 'data':data}
            scoreList.append(scoreData)
        
        self.response.out.write(json.dumps(scoreList))
Beispiel #4
0
    def get(self):
        gameKey = cgi.escape(self.request.get('gameKey'))
        game = Game.all().filter("gameKey =", gameKey).get()

        if (not game):
            self.response.set_status(500,
                                     message="Can't find game with key " +
                                     gameKey)
            return

        range = self.request.get('range')
        tags = self.request.get_all('tag')
        limit = self.request.get_range('limit')
        ascending = self.request.get('ascending')

        distinct = self.request.get('distinct', "true")
        distinct = False if distinct == "false" else True

        if (ascending == "true"):
            order = "points"
        else:
            order = "-points"

        rangeNumber = self.request.get_range('rangeNumber')

        year, month, week, day = dateutils.get_datetime_data(
            datetime.datetime.now())
        scores = scoreDao.get_scores(game, range, tags, order, limit, year,
                                     month, week, day, rangeNumber, distinct)

        self.response.headers['Content-Type'] = 'text/plain'
        scoreList = []
        for score in scores:
            data = json.loads(score.data)
            scoreData = {
                'id': str(score.key()),
                'profilePublicKey': score.profilePublicKey,
                'name': score.name,
                'tags': score.tags,
                'points': score.points,
                'timestamp':
                long(time.mktime(score.timestamp.timetuple()) * 1000),
                'data': data
            }
            scoreList.append(scoreData)

        self.response.out.write(json.dumps(scoreList))