Skip to content
Snippets Groups Projects
Commit bf9491ec authored by Erin Mullaney's avatar Erin Mullaney Committed by Todd Dembrey
Browse files

#962 add review queryset method to get associated opinions

parent e2c3c72e
No related branches found
No related tags found
No related merge requests found
...@@ -107,6 +107,9 @@ class ReviewQuerySet(models.QuerySet): ...@@ -107,6 +107,9 @@ class ReviewQuerySet(models.QuerySet):
else: else:
return MAYBE return MAYBE
def opinions(self):
return ReviewOpinion.objects.filter(review__id__in=self.values_list('id'))
class Review(ReviewFormFieldsMixin, BaseStreamForm, AccessFormData, models.Model): class Review(ReviewFormFieldsMixin, BaseStreamForm, AccessFormData, models.Model):
submission = models.ForeignKey('funds.ApplicationSubmission', on_delete=models.CASCADE, related_name='reviews') submission = models.ForeignKey('funds.ApplicationSubmission', on_delete=models.CASCADE, related_name='reviews')
......
...@@ -33,8 +33,7 @@ class ReviewContextMixin: ...@@ -33,8 +33,7 @@ class ReviewContextMixin:
reviews_dict[review.author.pk] = review reviews_dict[review.author.pk] = review
# Get all the authors of opinions, these authors should not show up in the 'xxx_not_reviewed' lists # Get all the authors of opinions, these authors should not show up in the 'xxx_not_reviewed' lists
opinion_authors = set(User.objects.filter( opinion_authors = User.objects.filter(pk__in=self.object.reviews.opinions().values('author')).distinct()
pk__in=ReviewOpinion.objects.filter(review__submission=self.object).values('author__pk')))
reviews_block = defaultdict(list) reviews_block = defaultdict(list)
for assigned_reviewer in assigned: for assigned_reviewer in assigned:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment