Pull in svn Rubyvote again
[selectricity] / lib / rubyvote / condorcet.rb
index 65c664dd28a57417aa0a90395562289c8de0eed4..0b7a3062afce476f5711fe8ce471c61264d61a87 100644 (file)
@@ -184,7 +184,10 @@ class PureCondorcetResult < CondorcetResult
   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
@@ -221,7 +224,7 @@ class CloneproofSSDResult < CondorcetResult
   def cpssd
     votes = @election.votes
     candidates = *@election.candidates
-
+    
     def in_schwartz_set?(candidate, candidates, transitive_defeats)
       candidates.each do |challenger|
         next if candidate == challenger

Benjamin Mako Hill || Want to submit a patch?