From c7bda41ddac96cbdf5d137ef3330f40865a9f93a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 26 Nov 2014 16:29:58 -0500 Subject: [PATCH] FIX: Use `OR` query instead of `AND`, also check that the profile is blank --- lib/admin_user_index_query.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/admin_user_index_query.rb b/lib/admin_user_index_query.rb index f2420f15a3..f8ac8a8ca8 100644 --- a/lib/admin_user_index_query.rb +++ b/lib/admin_user_index_query.rb @@ -43,14 +43,13 @@ class AdminUserIndexQuery where_conds = [] # One signal: no reading yet the user has bio text - where_conds << "user_stats.posts_read_count = 0 AND user_stats.topics_entered = 0 AND COALESCE(user_profiles.bio_raw, '') = ''" - # Another surprising signal: Username ends with a number - where_conds << "users.username ~ '[0-9]+$'" + where_conds << "user_stats.posts_read_count = 0 AND user_stats.topics_entered = 0" @query.activated .references(:user_stats) .includes(:user_profile) - .where(where_conds.map {|c| "(#{c})"}.join(" AND ")) + .where("COALESCE(user_profiles.bio_raw, '') != ''") + .where(where_conds.map {|c| "(#{c})"}.join(" OR ")) end def filter_by_query_classification