Skip to content

Commit 67b4123

Browse files
committed
Sort all proposals when sorting by total votes
1 parent 7d27bb8 commit 67b4123

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

junction/proposals/dashboard.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,21 +247,22 @@ def reviewer_votes_dashboard(request, conference_slug):
247247
elif votes == ProposalVotesFilter.MIN_ONE_VOTE:
248248
proposals_qs = [
249249
p for p in proposals_qs if p.get_reviewer_votes_count() >= votes]
250-
elif votes == ProposalVotesFilter.SORT_BY_SUM:
251-
proposals_qs = sorted(
252-
proposals_qs, key=lambda x: x.get_reviewer_votes_sum(),
253-
reverse=True)
254250
elif votes == ProposalVotesFilter.SORT_BY_REVIEWER:
255251
proposals_qs = sorted(
256252
proposals_qs,
257253
key=lambda x: x.get_reviewer_vote_value(reviewer=request.user),
258254
reverse=True,
259255
)
256+
elif votes == ProposalVotesFilter.SORT_BY_SUM:
257+
proposals_qs = sorted(
258+
proposals_qs, key=lambda x: x.get_reviewer_votes_sum(),
259+
reverse=True)
260+
proposals = [s_items('', proposals_qs)]
260261

261-
for section in proposal_sections:
262-
section_proposals = [
263-
p for p in proposals_qs if p.proposal_section == section]
264-
proposals.append(s_items(section, section_proposals))
262+
if votes != ProposalVotesFilter.SORT_BY_SUM:
263+
for section in proposal_sections:
264+
section_proposals = [p for p in proposals_qs if p.proposal_section == section]
265+
proposals.append(s_items(section, section_proposals))
265266

266267
return render(request, 'proposals/votes-dashboard.html',
267268
{'conference': conference,

junction/templates/proposals/votes-dashboard.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ <h2>Proposal Votes Dashboard</h2>
4141
</form>
4242
</div>
4343
<br />
44+
<hr>
4445
<div id="#proposals" class="row">
4546
{% for section_items in proposals %}
4647
{% if section_items.proposals %}

0 commit comments

Comments
 (0)