ignore a story's submitter's comments when calculating hotness

This commit is contained in:
joshua stein 2014-09-16 10:53:25 -05:00
parent d5474de775
commit 09bd0026d3

View file

@ -133,8 +133,11 @@ class Story < ActiveRecord::Base
base -= t.hotness_mod
end
# prevent the submitter's own comments from affecting the score
ccount = self.comments.where("user_id != ?", self.user_id).count
# don't immediately kill stories at 0 by bumping up score by one
order = Math.log([ (score + 1).abs + comments_count, 1 ].max, base)
order = Math.log([ (score + 1).abs + ccount, 1 ].max, base)
if score > 0
sign = 1
elsif score < 0