Revert "(un-oops)"
This commit is contained in:
parent
f937f337ba
commit
3f5ee591b6
1 changed files with 6 additions and 13 deletions
|
@ -257,16 +257,13 @@ def review_admin(request, section_slug):
|
||||||
continue
|
continue
|
||||||
already_seen.add(user.pk)
|
already_seen.add(user.pk)
|
||||||
|
|
||||||
user.comment_count = Review.objects.filter(
|
user.comment_count = Review.objects.filter(user=user).count()
|
||||||
user=user,
|
|
||||||
proposal__kind__section__slug=section_slug,
|
|
||||||
).count()
|
|
||||||
|
|
||||||
user_votes = LatestVote.objects.filter(
|
user_votes = LatestVote.objects.filter(
|
||||||
user=user,
|
user=user,
|
||||||
proposal__kind__section__slug=section_slug,
|
proposal__kind__section__slug=section_slug,
|
||||||
)
|
)
|
||||||
|
print section_slug
|
||||||
|
print [vote.proposal.kind.section.slug for vote in user_votes]
|
||||||
user.total_votes = user_votes.exclude(
|
user.total_votes = user_votes.exclude(
|
||||||
vote=LatestVote.VOTES.ABSTAIN,
|
vote=LatestVote.VOTES.ABSTAIN,
|
||||||
).count()
|
).count()
|
||||||
|
@ -285,23 +282,19 @@ def review_admin(request, section_slug):
|
||||||
user.abstain = user_votes.filter(
|
user.abstain = user_votes.filter(
|
||||||
vote=LatestVote.VOTES.ABSTAIN,
|
vote=LatestVote.VOTES.ABSTAIN,
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
if user.total_votes == 0:
|
if user.total_votes == 0:
|
||||||
user.average = "-"
|
user.average = "-"
|
||||||
else:
|
else:
|
||||||
user.average = (
|
user.average = (
|
||||||
((user.plus_two * 2) + user.plus_one) -
|
user.plus_two + user.plus_one +
|
||||||
((user.minus_two * 2) + user.minus_one)
|
user.minus_one + user.minus_two
|
||||||
) / (user.total_votes * 1.0)
|
) / (user.total_votes * 1.0)
|
||||||
|
|
||||||
yield user
|
yield user
|
||||||
|
|
||||||
reviewers_sorted = list(reviewers())
|
|
||||||
sort(reviewers_sorted: key= lambda reviewer: 0 - reviewer.total_votes)
|
|
||||||
|
|
||||||
ctx = {
|
ctx = {
|
||||||
"section_slug": section_slug,
|
"section_slug": section_slug,
|
||||||
"reviewers": reviewers_sorted,
|
"reviewers": reviewers(),
|
||||||
}
|
}
|
||||||
return render(request, "symposion/reviews/review_admin.html", ctx)
|
return render(request, "symposion/reviews/review_admin.html", ctx)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue