Beispiel #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
Beispiel #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
Beispiel #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()))
Beispiel #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()))