REFACTOR: remove where conditions array with only 1 item

This commit is contained in:
Régis Hanol 2019-02-11 15:42:32 +01:00 committed by GitHub
parent 705c898c21
commit b8d5f8d29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 11 deletions

View File

@ -76,18 +76,13 @@ class AdminUserIndexQuery
end
def 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")
end
def filter_by_query_classification