Skip to content

Commit 5ece6bf

Browse files
committed
Fixed the duplicate count bug
1 parent fbe0ed8 commit 5ece6bf

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

junction/proposals/dashboard.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
from xlsxwriter.workbook import Workbook
1717

1818
# Junction Stuff
19-
from junction.base.constants import ProposalReviewVote, ProposalStatus, ProposalVotesFilter
19+
from junction.base.constants import (
20+
ProposalReviewVote,
21+
ProposalStatus,
22+
ProposalVotesFilter
23+
)
2024
from junction.conferences.models import Conference, ConferenceProposalReviewer
2125

2226
from .forms import ProposalVotesFilterForm
@@ -146,8 +150,8 @@ def reviewer_comments_dashboard(request, conference_slug):
146150
by_conference[id][1] = ProposalComment.objects.filter(
147151
commenter=reviewers.reviewer,
148152
deleted=False, private=True,
149-
proposal__status=ProposalStatus.PUBLIC,
150-
proposal__conference=conference).count()
153+
proposal__status=ProposalStatus.PUBLIC,
154+
proposal__conference=conference).distinct('proposal').count()
151155
# by_section is dict with
152156
# find each reviewers section and their comments
153157
# Need to rework on this code section to make it 1-2 loops
@@ -243,7 +247,8 @@ def reviewer_votes_dashboard(request, conference_slug):
243247
p for p in proposals_qs if p.get_reviewer_votes_count() >= votes]
244248
elif votes == ProposalVotesFilter.SORT:
245249
proposals_qs = sorted(
246-
proposals_qs, key=lambda x: x.get_reviewer_votes_sum(), reverse=True)
250+
proposals_qs, key=lambda x: x.get_reviewer_votes_sum(),
251+
reverse=True)
247252

248253
for section in proposal_sections:
249254
section_proposals = [
@@ -299,10 +304,12 @@ def export_reviewer_votes(request, conference_slug):
299304
p.get_reviewer_votes_count(),) + \
300305
vote_details + (p.get_votes_count(), vote_comment,)
301306
if p.get_reviewer_votes_count_by_value(
302-
ProposalSectionReviewerVoteValue.objects.get(vote_value=ProposalReviewVote.NOT_ALLOWED)) > 0:
307+
ProposalSectionReviewerVoteValue.objects.get(
308+
vote_value=ProposalReviewVote.NOT_ALLOWED)) > 0:
303309
cell_format = book.add_format({'bg_color': 'red'})
304310
elif p.get_reviewer_votes_count_by_value(
305-
ProposalSectionReviewerVoteValue.objects.get(vote_value=ProposalReviewVote.MUST_HAVE)) > 2:
311+
ProposalSectionReviewerVoteValue.objects.get(
312+
vote_value=ProposalReviewVote.MUST_HAVE)) > 2:
306313
cell_format = book.add_format({'bg_color': 'green'})
307314
elif p.get_reviewer_votes_count() < 2:
308315
cell_format = book.add_format({'bg_color': 'yellow'})

0 commit comments

Comments
 (0)