You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by gs...@apache.org on 2019/04/02 01:19:22 UTC

svn commit: r1856790 - in /steve/trunk: monitoring/stv_tool.py whatif.py

Author: gstein
Date: Tue Apr  2 01:19:22 2019
New Revision: 1856790

URL: http://svn.apache.org/viewvc?rev=1856790&view=rev
Log:
run_vote(): always return the candidates, and let the caller print the results

Modified:
    steve/trunk/monitoring/stv_tool.py
    steve/trunk/whatif.py

Modified: steve/trunk/monitoring/stv_tool.py
URL: http://svn.apache.org/viewvc/steve/trunk/monitoring/stv_tool.py?rev=1856790&r1=1856789&r2=1856790&view=diff
==============================================================================
--- steve/trunk/monitoring/stv_tool.py (original)
+++ steve/trunk/monitoring/stv_tool.py Tue Apr  2 01:19:22 2019
@@ -116,10 +116,10 @@ def run_vote(names, votes, num_seats):
   if candidates.count(ELECTED + HOPEFUL) <= num_seats:
     dbg('All candidates elected')
     candidates.change_state(HOPEFUL, ELECTED)
-    return
+    return candidates
   if num_seats <= 0:
     candidates.change_state(HOPEFUL, ELIMINATED)
-    return
+    return candidates
 
   quota = None  # not used on first pass
   iteration = 1
@@ -131,6 +131,7 @@ def run_vote(names, votes, num_seats):
 
   dbg('All seats full')
   candidates.change_state(HOPEFUL, ELIMINATED)
+  return candidates
 
   candidates.print_results()
 
@@ -404,5 +405,6 @@ if __name__ == '__main__':
 
   names, votes = load_votes(votefile)
 
-  run_vote(names, votes, num_seats)
+  candidates = run_vote(names, votes, num_seats)
+  candidates.print_results()
   print 'Done!'

Modified: steve/trunk/whatif.py
URL: http://svn.apache.org/viewvc/steve/trunk/whatif.py?rev=1856790&r1=1856789&r2=1856790&view=diff
==============================================================================
--- steve/trunk/whatif.py (original)
+++ steve/trunk/whatif.py Tue Apr  2 01:19:22 2019
@@ -90,5 +90,6 @@ if __name__ == '__main__':
     if votes[hashid] == []: del votes[hashid]
 
   # run the vote
-  stv_tool.run_vote(names, votes, seats)
+  candidates = stv_tool.run_vote(names, votes, seats)
+  candidates.print_results()
   print 'Done!'