A platform for community discussion. Free, open, simple.
REFACTOR: remove where conditions array with only 1 item
Régis Hanolb8d5f8d29d33
diff --git a/lib/admin_user_index_query.rb b/lib/admin_user_index_query.rbindex 83bc4dc84ae..2341b4d4e3d 100644--- a/lib/admin_user_index_query.rb+++ b/lib/admin_user_index_query.rb@@ -76,18 +76,13 @@ class AdminUserIndexQueryenddef suspect_users- where_conds = []-- # One signal: no reading yet the user has bio text- where_conds << "user_stats.posts_read_count <= 1 AND user_stats.topics_entered <= 1"-- @query.activated+ @query+ .activated.human_users- .references(:user_stats)- .includes(:user_profile)- .where("COALESCE(user_profiles.bio_raw, '') != ''")- .where('users.created_at <= ?', 1.day.ago)- .where(where_conds.map { |c| "(#{c})" }.join(" OR "))+ .joins(:user_profile, :user_stat)+ .where("users.created_at <= ?", 1.day.ago)+ .where("LENGTH(COALESCE(user_profiles.bio_raw, '')) > 0")+ .where("user_stats.posts_read_count <= 1 AND user_stats.topics_entered <= 1")enddef filter_by_query_classification