Return an integer for the slice index.
Resolves: File "/app/symposion_app/vendor/symposion/reviews/views.py", line 230, in review_random_proposal proposals = proposals[:(len(proposals) + 1) / 2] TypeError: slice indices must be integers or None or have an __index__ method
This commit is contained in:
parent
7b58bfafa6
commit
7fe5a09bfb
1 changed files with 2 additions and 2 deletions
4
vendor/symposion/reviews/views.py
vendored
4
vendor/symposion/reviews/views.py
vendored
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import math
|
||||
import random
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
@ -226,8 +227,7 @@ def review_random_proposal(request, section_slug):
|
|||
proposals = list(proposals)
|
||||
proposals.sort(key=lambda proposal: proposal.total_votes)
|
||||
# The first half is the median or less.
|
||||
# The +1 means we round _up_.
|
||||
proposals = proposals[:(len(proposals) + 1) / 2]
|
||||
proposals = proposals[:math.ceil(len(proposals) / 2)]
|
||||
|
||||
# Realistically, there shouldn't be all that many proposals to choose
|
||||
# from, so this should be cheap.
|
||||
|
|
Loading…
Reference in a new issue