Adds abstains and averages to the reviewers scores list.
This commit is contained in:
parent
2a6c192449
commit
3217f43af2
1 changed files with 20 additions and 13 deletions
|
@ -258,23 +258,30 @@ def review_admin(request, section_slug):
|
||||||
already_seen.add(user.pk)
|
already_seen.add(user.pk)
|
||||||
|
|
||||||
user.comment_count = Review.objects.filter(user=user).count()
|
user.comment_count = Review.objects.filter(user=user).count()
|
||||||
user.total_votes = LatestVote.objects.filter(user=user).count()
|
user_votes = LatestVote.objects.filter(
|
||||||
user.plus_two = LatestVote.objects.filter(
|
user=user
|
||||||
user=user,
|
)
|
||||||
vote=LatestVote.VOTES.PLUS_TWO
|
user.total_votes = user_votes.exclude(
|
||||||
|
vote=LatestVote.VOTES.ABSTAIN,
|
||||||
).count()
|
).count()
|
||||||
user.plus_one = LatestVote.objects.filter(
|
user.plus_two = user_votes.filter(
|
||||||
user=user,
|
vote=LatestVote.VOTES.PLUS_TWO,
|
||||||
vote=LatestVote.VOTES.PLUS_ONE
|
|
||||||
).count()
|
).count()
|
||||||
user.minus_one = LatestVote.objects.filter(
|
user.plus_one = user_votes.filter(
|
||||||
user=user,
|
vote=LatestVote.VOTES.PLUS_ONE,
|
||||||
vote=LatestVote.VOTES.MINUS_ONE
|
|
||||||
).count()
|
).count()
|
||||||
user.minus_two = LatestVote.objects.filter(
|
user.minus_one = user_votes.filter(
|
||||||
user=user,
|
vote=LatestVote.VOTES.MINUS_ONE,
|
||||||
vote=LatestVote.VOTES.MINUS_TWO
|
|
||||||
).count()
|
).count()
|
||||||
|
user.minus_two = user_votes.filter(
|
||||||
|
vote=LatestVote.VOTES.MINUS_TWO,
|
||||||
|
).count()
|
||||||
|
user.abstain = user_votes.filter(
|
||||||
|
vote=LatestVote.VOTES.ABSTAIN,
|
||||||
|
).count()
|
||||||
|
user.average = (
|
||||||
|
user.plus_two + user.plus_one + user.minus_one + user.minus_two
|
||||||
|
) / (user.total_votes * 1.0)
|
||||||
|
|
||||||
yield user
|
yield user
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue