better tag hotness mod calculation
This commit is contained in:
parent
1cc16ecfbf
commit
c151fbeeb8
|
@ -132,9 +132,9 @@ class Story < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def calculated_hotness
|
||||
base = 10
|
||||
base = 0
|
||||
self.tags.select{|t| t.hotness_mod != 0 }.each do |t|
|
||||
base -= t.hotness_mod
|
||||
base += t.hotness_mod
|
||||
end
|
||||
|
||||
# give a story's comment votes some weight, but ignore the story
|
||||
|
@ -144,7 +144,7 @@ class Story < ActiveRecord::Base
|
|||
inject(&:+).to_i
|
||||
|
||||
# don't immediately kill stories at 0 by bumping up score by one
|
||||
order = Math.log([ (score + 1).abs + cpoints, 1 ].max, base)
|
||||
order = Math.log([ (score + 1).abs + cpoints, 1 ].max, 10)
|
||||
if score > 0
|
||||
sign = 1
|
||||
elsif score < 0
|
||||
|
@ -156,7 +156,7 @@ class Story < ActiveRecord::Base
|
|||
# TODO: as the site grows, shrink this down to 12 or so.
|
||||
window = 60 * 60 * 24
|
||||
|
||||
return -((order * sign) + (self.created_at.to_f / window)).round(7)
|
||||
return -((order * sign) + base + (self.created_at.to_f / window)).round(7)
|
||||
end
|
||||
|
||||
def can_be_seen_by_user?(user)
|
||||
|
|
Loading…
Reference in a new issue