You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by hu...@apache.org on 2015/03/25 00:25:49 UTC
svn commit: r1669021 - /steve/trunk/pysteve/lib/plugins/dh.py
Author: humbedooh
Date: Tue Mar 24 23:25:49 2015
New Revision: 1669021
URL: http://svn.apache.org/r1669021
Log:
fix tallying for D'Hondt
Modified:
steve/trunk/pysteve/lib/plugins/dh.py
Modified: steve/trunk/pysteve/lib/plugins/dh.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/plugins/dh.py?rev=1669021&r1=1669020&r2=1669021&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/plugins/dh.py (original)
+++ steve/trunk/pysteve/lib/plugins/dh.py Tue Mar 24 23:25:49 2015
@@ -52,20 +52,21 @@ def tallyDH(votes, issue):
# Set up vote matrix
matrix = {}
- for vote in votes:
+ for key in votes:
+ vote = votes[key]
matrix[vote] = [(matrix[vote] if vote in matrix else 0) + 1, 1]
# Start counting
while len(winners) < numseats:
m = []
for c in matrix:
- quotient = (matrix[c][1]/matrix[c][2])
- m.push(quotient)
+ quotient = (matrix[c][0]/matrix[c][1])
+ m.append(quotient)
for c in matrix:
- quotient = (matrix[c][1]/matrix[c][2])
+ quotient = (matrix[c][0]/matrix[c][1])
if quotient == max(m):
winners.append(c)
- matrix[c][2] += 1
+ matrix[c][1] += 1
# Compile list of winner names
winnernames = []