From 42150c8a56759fa44a96d77c763225fed6baef9e Mon Sep 17 00:00:00 2001 From: joshua stein Date: Mon, 17 Sep 2012 19:24:33 -0500 Subject: [PATCH] fix karma adjustment when not upvoting --- app/models/vote.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/vote.rb b/app/models/vote.rb index eec8c32..74895a3 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -138,7 +138,8 @@ class Vote < ActiveRecord::Base if v.comment_id c = Comment.find(v.comment_id) if c.user_id != user_id - Keystore.increment_value_for("user:#{c.user_id}:karma") + Keystore.increment_value_for("user:#{c.user_id}:karma", + upvote - downvote) end c.give_upvote_or_downvote_and_recalculate_confidence!(upvote, @@ -146,7 +147,8 @@ class Vote < ActiveRecord::Base else s = Story.find(v.story_id) if s.user_id != user_id - Keystore.increment_value_for("user:#{s.user_id}:karma") + Keystore.increment_value_for("user:#{s.user_id}:karma", + upvote - downvote) end s.give_upvote_or_downvote_and_recalculate_hotness!(upvote, downvote)