]> projects.mako.cc - selectricity/commitdiff
Pull in svn Rubyvote again
authorJohn Dong <jdong@mit.edu>
Wed, 15 Aug 2007 20:17:11 +0000 (16:17 -0400)
committerJohn Dong <jdong@mit.edu>
Wed, 15 Aug 2007 20:17:11 +0000 (16:17 -0400)
lib/rubyvote/condorcet.rb
lib/rubyvote/election.rb
lib/rubyvote/irv.rb

index c0539abea5f02aa5b11ddda80fd41f68e78b9b8e..0b7a3062afce476f5711fe8ce471c61264d61a87 100644 (file)
@@ -185,7 +185,7 @@ class PureCondorcetResult < CondorcetResult
     votes = @election.votes
     candidates = @election.candidates
     unless votes.length>0 and candidates.length>0
     votes = @election.votes
     candidates = @election.candidates
     unless votes.length>0 and candidates.length>0
-      @winners=[nil]
+      @winners=[]
       return @winners
     end
     victors = Hash.new
       return @winners
     end
     victors = Hash.new
@@ -224,7 +224,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
index b9bb5574c7ea03b4d9d5d6e1b544fdca640e3ee3..42f18bb6c9fa7470e34c46051787573b377fdce2 100644 (file)
@@ -133,7 +133,7 @@ class ElectionResult
   end
 
   def winner?
   end
 
   def winner?
-    @winners.length > 0
+    @winners.length > 0 and not @winners[0].nil?
   end
 
 end
   end
 
 end
index b26b1d1990720fe85cf5e78774bbd8642098e378..c3fabe6e488de75352c1ae53305e0a1b0785022c 100644 (file)
@@ -88,7 +88,7 @@ class InstantRunoffResult < ElectionResult
     end
     
     unless votes.length > 0
     end
     
     unless votes.length > 0
-      @winners=[nil]
+      @winners=[]
       return
     end
 
       return
     end
 

Benjamin Mako Hill || Want to submit a patch?