From 57ad0f20e04f039cb032d13ba091ff5731e070ad Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Tue, 9 Oct 2018 21:16:13 +0200 Subject: [PATCH] Return helpful/unhelpful votes from the Review model --- backend/postings/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/postings/models.py b/backend/postings/models.py index d998984..d660248 100644 --- a/backend/postings/models.py +++ b/backend/postings/models.py @@ -63,11 +63,11 @@ class Review(models.Model): # Gets the total number of votes which marked this review as 'helpful'. def getHelpfulVoteCount(self): - ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=True).count() + return ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=True).count() # Gets the total number of votes which marked this review as 'unhelpful'. def getUnhelpfulVoteCount(self): - ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=False).count() + return ReviewHelpfulVote.objects.filter(pk=self.pk, helpful=False).count() # A vote for a review as either positive or negative. class ReviewHelpfulVote(models.Model):