Skip to content

Commit

Permalink
#2168: Fix cardinality error due to group by assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromsl committed Apr 27, 2021
1 parent 2f39b97 commit 1f11c27
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/review/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def get_reviewer_candidates(article, user=None):
rating_average = models.ReviewerRating.objects.filter(
assignment__article__journal=article.journal,
assignment__reviewer=OuterRef("id"),
).values(
# Without this .values call, results are grouped by assignment...
"assignment__article__journal",
).annotate(
rating_average=Avg("rating"),
).values("rating_average")
Expand Down

0 comments on commit 1f11c27

Please sign in to comment.