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/23 09:25:08 UTC
svn commit: r1668538 - /steve/trunk/pysteve/www/cgi-bin/lib/election.py
Author: humbedooh
Date: Mon Mar 23 08:25:07 2015
New Revision: 1668538
URL: http://svn.apache.org/r1668538
Log:
Tidy up debug log generation
Modified:
steve/trunk/pysteve/www/cgi-bin/lib/election.py
Modified: steve/trunk/pysteve/www/cgi-bin/lib/election.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/www/cgi-bin/lib/election.py?rev=1668538&r1=1668537&r2=1668538&view=diff
==============================================================================
--- steve/trunk/pysteve/www/cgi-bin/lib/election.py (original)
+++ steve/trunk/pysteve/www/cgi-bin/lib/election.py Mon Mar 23 08:25:07 2015
@@ -117,8 +117,6 @@ def deleteIssue(electionID, issueID):
raise Exception("No such election")
-debug = []
-
def yna(votes):
y = n = a = 0
@@ -162,8 +160,6 @@ def getproportion(votes, winners, step,
if step > 0:
for c in prop:
prop[c] *= surplus / tvotes
-
- debug.append("Proportional move: %s" % json.dumps(prop))
return prop
@@ -175,6 +171,8 @@ def stv(candidates, votes, numseats):
:return:
"""
+ debug = []
+
# Set up letters for mangling
letters = [chr(i) for i in range(ord('a'), ord('a') + len(candidates))]
cc = "".join(letters)
@@ -204,6 +202,11 @@ def stv(candidates, votes, numseats):
y = 0
# Get votes
xpoints = getproportion(votes, winners, y, 0)
+ if turn == 1:
+ debug.append("Initial tally: %s" % json.dumps(xpoints))
+ else:
+ debug.append("Proportional move: %s" % json.dumps(xpoints))
+
for x in xpoints:
points[x] += xpoints[x]
mq = 0