projects
/
rubyvote
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
21e8998
)
Add somewhat hackish fix for PureCondorcetVote.new([]).result deadlocking
author
John Dong
<jdong@mit.edu>
Wed, 15 Aug 2007 19:38:02 +0000
(19:38 +0000)
committer
John Dong
<jdong@mit.edu>
Wed, 15 Aug 2007 19:38:02 +0000
(19:38 +0000)
git-svn-id: svn://rubyforge.org/var/svn/rubyvote/trunk@33
1440c7f4
-e209-0410-9a04-
881b5eb134a8
lib/rubyvote/condorcet.rb
patch
|
blob
|
history
diff --git
a/lib/rubyvote/condorcet.rb
b/lib/rubyvote/condorcet.rb
index 65c664dd28a57417aa0a90395562289c8de0eed4..c0539abea5f02aa5b11ddda80fd41f68e78b9b8e 100644
(file)
--- a/
lib/rubyvote/condorcet.rb
+++ b/
lib/rubyvote/condorcet.rb
@@
-184,7
+184,10
@@
class PureCondorcetResult < CondorcetResult
def condorcet
votes = @election.votes
candidates = @election.candidates
def condorcet
votes = @election.votes
candidates = @election.candidates
-
+ unless votes.length>0 and candidates.length>0
+ @winners=[nil]
+ return @winners
+ end
victors = Hash.new
candidates.each do |candidate|
victors[candidate] = Array.new
victors = Hash.new
candidates.each do |candidate|
victors[candidate] = Array.new
Benjamin Mako Hill
||
Want to submit a patch?