empty badge grant job
This commit is contained in:
parent
9038701520
commit
219444eab2
|
@ -4,7 +4,7 @@ module Jobs
|
|||
every 1.minutes
|
||||
|
||||
def execute(_args)
|
||||
puts '====================== The Job was executed ==========================='
|
||||
puts '====================== The Award Group Job was executed ==========================='
|
||||
user_queue.each do |email|
|
||||
user = User.find_by_email(email)
|
||||
DiscourseDonations::Rewards.new(user).add_to_group(group_name) if user.present?
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
module Jobs
|
||||
class GrantBadge < ::Jobs::Scheduled
|
||||
every 5.minutes
|
||||
|
||||
def execute(_args)
|
||||
puts '====================== The Grant Badge Job was executed ==========================='
|
||||
end
|
||||
end
|
||||
end
|
|
@ -12,6 +12,7 @@ enabled_site_setting :discourse_donations_enabled
|
|||
|
||||
after_initialize do
|
||||
load File.expand_path('../app/jobs/award_group.rb', __FILE__)
|
||||
load File.expand_path('../app/jobs/grant_badge.rb', __FILE__)
|
||||
|
||||
# Must be placed on every page for fraud protection.
|
||||
header_script = '<script src="https://js.stripe.com/v3/"></script>'
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
RSpec.describe Jobs::GrantBadge, type: :job do
|
||||
let(:users) { [Fabricate(:user), Fabricate(:user)] }
|
||||
let(:badge) { Fabricate(:badge, name: 'el-grande') }
|
||||
|
||||
before do
|
||||
SiteSetting.stubs(:discourse_donations_reward_badge_name).returns(badge.name)
|
||||
end
|
||||
|
||||
it 'grants all the users the badge'
|
||||
end
|
Loading…
Reference in New Issue