lib/rank.rb
# The second vote offsets the score by 1%. Each vote after that will
# be 90% of the weight of the last person.
The second vote offsets the score by 1%. Each vote after that will
be 90% of the weight of the last person.
The second vote offsets the score by 1% . Each vote after that will be 90% of the weight of the last person .
def weight percent, votes_remaining
      return 1 if votes_remaining.zero?
      direction = good? ? 1 : -1
      factor = (1 + direction * percent.to_f / 100)
      factor * weight(percent * 0.9, votes_remaining - 1)
    rescue SystemStackError
      1
    end
def weight percent , votes_remaining return 1 if votes_remaining . zero? direction = good? ? 1 : - 1 factor = ( 1 + direction * percent . to_f / 100 ) factor * weight ( percent * 0.9 , votes_remaining - 1 ) rescue SystemStackError 1 end
The second vote offsets the score by 1%.
The second vote offsets the score by 1% .
# We had so many votes we blew the stack. At this point each vote isn't # adding much so just stop the recusion
percent
<not_specific>
votes_remaining
<not_specific>