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