Ejemplo n.º 1
0
 def average_reviews_about_me_css_class_name(self):
     from django.db.models import Sum
     cargos1 = Cargo.objects.filter(traveller_user=self.user, traveller_user_review_stars__isnull=False).distinct().aggregate(num=Sum('traveller_user_review_stars'))
     val1 = cargos1['num']
     cargos2 = Cargo.objects.filter(requesting_user=self.user, requesting_user_review_stars__isnull=False).distinct().aggregate(num=Sum('requesting_user_review_stars'))
     val2 = cargos2['num']
     val3 = (val1 or 0 + val2 or 0) / self.get_reviews_about_me.count()
     return Cargo.css_class_name(val3)
Ejemplo n.º 2
0
 def average_traveller_review_css_class_name(self):
     return Cargo.css_class_name(self.get_average_reviews_about_me_as_traveller_score['traveller_user_review_stars__avg'])