From 6f77742017295b95afb6b898922bd97f8f4ff82f Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 14 Mar 2016 16:53:53 -0700 Subject: [PATCH] admins are always counted as supervoters --- app/logical/daily_maintenance.rb | 1 - app/models/super_voter.rb | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/logical/daily_maintenance.rb b/app/logical/daily_maintenance.rb index 067c6cbf8..e212a161b 100644 --- a/app/logical/daily_maintenance.rb +++ b/app/logical/daily_maintenance.rb @@ -15,7 +15,6 @@ class DailyMaintenance TagAlias.update_cached_post_counts_for_all PostDisapproval.dmail_messages! Tag.clean_up_negative_post_counts! - SuperVoter.prune! SuperVoter.init! end end diff --git a/app/models/super_voter.rb b/app/models/super_voter.rb index a8797b30d..11f5f342c 100644 --- a/app/models/super_voter.rb +++ b/app/models/super_voter.rb @@ -12,6 +12,7 @@ class SuperVoter < ActiveRecord::Base end def self.init! + prune! report = Reports::UserSimilarity.new(User.admins.first.id) report.prime report.fetch_similar_user_ids.scan(/\S+/).in_groups_of(2).each do |user_id, score| @@ -19,6 +20,12 @@ class SuperVoter < ActiveRecord::Base create(:user_id => user_id) end end + + User.admins.each do |user| + unless where("user_id = ?", user.id).exists? + create(:user_id => user.id) + end + end end def update_user_on_create