continue to backport old code
This commit is contained in:
19
app/workers/wow_mounts_collection_worker.rb
Normal file
19
app/workers/wow_mounts_collection_worker.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class WowMountsCollectionWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(user_id)
|
||||
# Update the WoW character list
|
||||
return unless (user = User.find(user_id))
|
||||
|
||||
RBattlenet.set_options(locale: 'en_US')
|
||||
result = RBattlenet::Wow::Profile::MountsCollection.find(user.token)
|
||||
|
||||
return unless result.status_code == 200
|
||||
|
||||
result.mounts.each do |mount|
|
||||
next unless (local_mount = WowMount.where(mount_id: mount.mount.id).first)
|
||||
|
||||
UserObtainWowMount.where(user: user.id, wow_mount: local_mount.id).first_or_create
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user