projects
/
rubyvote
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Work around CloneProofSSD returning [nil] rather than [] for empty vote
[rubyvote]
/
lib
/
rubyvote
/
condorcet.rb
diff --git
a/lib/rubyvote/condorcet.rb
b/lib/rubyvote/condorcet.rb
index 65c664dd28a57417aa0a90395562289c8de0eed4..aaa504477373e07735b6eab9b7c847db0c68232a 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=[]
+ 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
@@
-214,6
+217,7
@@
class CloneproofSSDResult < CondorcetResult
def initialize(voteobj=nil)
super(voteobj)
@winners = self.cpssd()
def initialize(voteobj=nil)
super(voteobj)
@winners = self.cpssd()
+ @winners.delete nil
end
protected
end
protected
Benjamin Mako Hill
||
Want to submit a patch?