A platform for community discussion. Free, open, simple.
FIX: don't grant new user of the month badge to suspended users or based on deleted topics/posts
Régis Hanol7d501058d7e0
diff --git a/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb b/app/jobs/scheduled/grant_new_user_of_the_month_badges.rbindex 86d3a3a1d93..5a2803b7206 100644--- a/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb+++ b/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb@@ -64,12 +64,16 @@ module JobsLEFT OUTER JOIN topics AS t ON t.id = p.topic_idWHERE u.activeAND u.id > 0+ AND u.id NOT IN (#{current_owners.join(',')})AND NOT u.stagedAND NOT u.adminAND NOT u.moderator- AND t.archetype <> '#{Archetype.private_message}'+ AND u.suspended_at IS NULL+ AND u.suspended_till IS NULLAND u.created_at >= CURRENT_TIMESTAMP - '1 month'::INTERVAL- AND u.id NOT IN (#{current_owners.join(',')})+ AND t.archetype <> '#{Archetype.private_message}'+ AND t.deleted_at IS NULL+ AND p.deleted_at IS NULLGROUP BY u.idHAVING COUNT(DISTINCT p.id) > 1AND COUNT(DISTINCT p.topic_id) > 1