Also skip locked users in the job query

This commit is contained in:
riking 2014-09-13 14:10:30 -07:00 committed by Sam
parent 4aabc44264
commit 760465959f
1 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,7 @@ module Jobs
def execute(args) def execute(args)
# Demotions # Demotions
demoted_user_ids = [] demoted_user_ids = []
User.real.where(trust_level: TrustLevel[3]).find_each do |u| User.real.where(trust_level: TrustLevel[3], trust_level_locked: false).find_each do |u|
# Don't demote too soon after being promoted # Don't demote too soon after being promoted
next if user.on_leader_grace_period? next if user.on_leader_grace_period?
@ -17,7 +17,9 @@ module Jobs
end end
# Promotions # Promotions
User.real.where(trust_level: TrustLevel[2]).where.not(id: demoted_user_ids).find_each do |u| User.real.where(trust_level: TrustLevel[2],
trust_level_locked: false)
.where.not(id: demoted_user_ids).find_each do |u|
Promotion.new(u).review_tl2 Promotion.new(u).review_tl2
end end
end end