projects
/
rubyvote
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
0e05e46
)
Add similar hackish "fix" for IRVL deadlocking on empty vote
author
John Dong
<jdong@mit.edu>
Wed, 15 Aug 2007 19:53:05 +0000
(19:53 +0000)
committer
John Dong
<jdong@mit.edu>
Wed, 15 Aug 2007 19:53:05 +0000
(19:53 +0000)
git-svn-id: svn://rubyforge.org/var/svn/rubyvote/trunk@35
1440c7f4
-e209-0410-9a04-
881b5eb134a8
lib/rubyvote/irv.rb
patch
|
blob
|
history
diff --git
a/lib/rubyvote/irv.rb
b/lib/rubyvote/irv.rb
index 38517381e2591770188aec70abec6f2d147adf61..b26b1d1990720fe85cf5e78774bbd8642098e378 100644
(file)
--- a/
lib/rubyvote/irv.rb
+++ b/
lib/rubyvote/irv.rb
@@
-87,6
+87,11
@@
class InstantRunoffResult < ElectionResult
apply_retention(votes, votes_sum * params['percent_retention'])
end
+ unless votes.length > 0
+ @winners=[nil]
+ return
+ end
+
begin
ranked_candidates = votes.sort do |a, b|
b[1][0] <=> a[1][0]
Benjamin Mako Hill
||
Want to submit a patch?