comments have an initial upvote of 1, which has a non-zero confidence

This commit is contained in:
joshua stein 2012-09-14 15:54:45 -05:00
parent a51ca8c533
commit 45a498ea51

View file

@ -11,7 +11,7 @@ class Comment < ActiveRecord::Base
attr_accessor :parent_comment_short_id, :current_vote, :previewing,
:indent_level, :highlighted
before_create :assign_short_id_and_upvote
before_create :assign_short_id_and_upvote, :assign_initial_confidence
after_create :assign_votes, :mark_submitter, :deliver_reply_notifications
after_destroy :unassign_votes
@ -190,6 +190,10 @@ class Comment < ActiveRecord::Base
return (left - right) / under
end
def assign_initial_confidence
self.confidence = self.calculated_confidence
end
def unassign_votes
self.story.update_comment_count!
end