]> projects.mako.cc - selectricity-live/blobdiff - lib/rubyvote/election.rb
Added Sparklines controller and dependency, see README. Created method and table...
[selectricity-live] / lib / rubyvote / election.rb
index 42f18bb6c9fa7470e34c46051787573b377fdce2..5a5824341a57c1f4c9f6aef7ec14ed41f40dc693 100644 (file)
@@ -45,7 +45,7 @@ class ElectionVote
           if self.verify_vote(vote)
             self.tally_vote(vote)
           else
           if self.verify_vote(vote)
             self.tally_vote(vote)
           else
-            raise InvalidVoteError.new ("Invalid vote object", vote)
+            raise InvalidVoteError.new("Invalid vote object", vote)
           end
         end
       else
           end
         end
       else
@@ -140,7 +140,8 @@ end
 
 class PluralityResult < ElectionResult
   attr_reader :ranked_candidates
 
 class PluralityResult < ElectionResult
   attr_reader :ranked_candidates
-
+  attr_reader :points
+  
   def initialize(voteobj=nil)
     super(voteobj)
 
   def initialize(voteobj=nil)
     super(voteobj)
 
@@ -151,6 +152,8 @@ class PluralityResult < ElectionResult
       b[1] <=> a[1]
     end.collect {|a| a[0]}
     
       b[1] <=> a[1]
     end.collect {|a| a[0]}
     
+    @points = @election.votes
+    
     # winners are anyone who has the same number of votes as the
     # first person
     @winners = @ranked_candidates.find_all do |i|
     # winners are anyone who has the same number of votes as the
     # first person
     @winners = @ranked_candidates.find_all do |i|

Benjamin Mako Hill || Want to submit a patch?