Esempio n. 1
0
    def percentage(self):
        """Return the rating as a percentage"""

        cached = self.cache_get('percentage')
        if cached:
            return cached

        percent = format.smart_round(self.rating(100))

        self.cache_set('percentage', percent)

        return percent
Esempio n. 2
0
    def percentage(self):
        """Return the rating as a percentage"""

        cached = self.cache_get('percentage')
        if cached:
            return cached

        percent = format.smart_round(self.rating(100))

        self.cache_set('percentage', percent)

        return percent
Esempio n. 3
0
    def ratings_rank(self):
        """Return the rating categories as a rank (percentage)"""

        func = lambda (x, y): (x, format.smart_round(y / 5) * 100)
        return dict(map(func, self.ratings().iteritems()))
Esempio n. 4
0
    def ratings_rank(self):
        """Return the rating categories as a rank (percentage)"""

        func = lambda (x,y): (x, format.smart_round(y / 5) * 100)
        return dict(map(func, self.ratings().iteritems()))