eliminate antivoter concept

This commit is contained in:
Albert Yi
2017-01-03 17:11:00 -08:00
parent 094f30a44e
commit 284008e078
2 changed files with 0 additions and 35 deletions

View File

@@ -17,6 +17,5 @@ class DailyMaintenance
Tag.clean_up_negative_post_counts!
PostApproval.prune!
SuperVoter.init!
AntiVoter.init!
end
end

View File

@@ -1,34 +0,0 @@
class AntiVoter < ActiveRecord::Base
MAGNITUDE = 3
DURATION = 1.week
belongs_to :user
validates_uniqueness_of :user_id
# after_create :update_user_on_create
# after_destroy :update_user_on_destroy
def self.prune!
where("created_at < ?", DURATION.ago).destroy_all
end
def self.init!
prune!
report = PostVoteSimilarity.new(User.admins.first.id)
report.calculate_negative.each do |element|
unless where("user_id = ?", element.user_id).exists?
create(:user_id => element.user_id)
end
end
end
# def update_user_on_create
# user.is_super_voter = true
# user.save
# end
# def update_user_on_destroy
# user.is_super_voter = false
# user.save
# end
end