Work around CloneProofSSD returning [nil] rather than [] for empty vote
authorJohn Dong <jdong@mit.edu>
Wed, 15 Aug 2007 20:27:12 +0000 (20:27 +0000)
committerJohn Dong <jdong@mit.edu>
Wed, 15 Aug 2007 20:27:12 +0000 (20:27 +0000)
git-svn-id: svn://rubyforge.org/var/svn/rubyvote/trunk@37 1440c7f4-e209-0410-9a04-881b5eb134a8

lib/rubyvote/condorcet.rb

index 0b7a3062afce476f5711fe8ce471c61264d61a87..aaa504477373e07735b6eab9b7c847db0c68232a 100644 (file)
@@ -217,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
@@ -224,7 +225,7 @@ class CloneproofSSDResult < CondorcetResult
   def cpssd
     votes = @election.votes
     candidates = *@election.candidates
   def cpssd
     votes = @election.votes
     candidates = *@election.candidates
-    
+
     def in_schwartz_set?(candidate, candidates, transitive_defeats)
       candidates.each do |challenger|
         next if candidate == challenger
     def in_schwartz_set?(candidate, candidates, transitive_defeats)
       candidates.each do |challenger|
         next if candidate == challenger

Benjamin Mako Hill || Want to submit a patch?