summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1723e5c)
frequently. Thanks Justin Sharps!
git-svn-id: svn://rubyforge.org/var/svn/rubyvote/trunk@28
1440c7f4-e209-0410-9a04-
881b5eb134a8
def tally_vote(vote)
points = candidates.length - 1
vote.each do |candidate|
def tally_vote(vote)
points = candidates.length - 1
vote.each do |candidate|
- @votes[candidate] = points
+ #if the candidate exist, add the points, otherwise assign them
+ if @votes.has_key?(candidate)
+ @votes[candidate] += points
+ else
+ @votes[candidate] = points
+ end
end
class BordaResult < ElectionResult
end
class BordaResult < ElectionResult
+ attr_reader :ranked_candidates
+
def initialize(voteobj=nil)
super(voteobj)
votes = @election.votes
def initialize(voteobj=nil)
super(voteobj)
votes = @election.votes