Example #1
0
 def score(self) -> float:
     dummies = RatingDummy.dummies_for(
         self, ("Semester", "Finals", "Interesting")).values_list("id",
                                                                  flat=True)
     ratings = Rating.objects.filter(
         Q(object_id__in=dummies) & Q(content_type__model="ratingdummy")
         & ~Q(count=0))
     if not ratings.exists():
         return 0
     return sum(ratings.values_list("average", flat=True)) / len(ratings)
Example #2
0
 def interesting_rating(self) -> RatingDummy:
     return RatingDummy.dummy_for(self, "Interesting")
Example #3
0
 def finals_rating(self) -> RatingDummy:
     return RatingDummy.dummy_for(self, "Finals")
Example #4
0
 def semester_rating(self) -> RatingDummy:
     return RatingDummy.dummy_for(self, "Semester")