Skip to content

Commit 99d4371

Browse files
Merge pull request #57 from Purple-Stock/fix/mass-action-good-job
refactor bling_order_item.rb, bling_order_item.rb: task #56
2 parents d2720e6 + 4ec6308 commit 99d4371

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/jobs/order_items_job.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
class OrderItemsJob < ApplicationJob
22
queue_as :items
33

4-
def perform(record)
4+
def perform(bling_order_id)
5+
record = BlingOrderItem.find_by(bling_order_id:)
56
account_id = record.account_id
67
items_attributes = []
7-
order = Services::Bling::FindOrder.call(id: record.bling_order_id, order_command: 'find_order', tenant: account_id)
8+
order = Services::Bling::FindOrder.call(id: bling_order_id, order_command: 'find_order', tenant: account_id)
89
raise(StandardError, order['error']) if order['error'].present?
910

1011
order['data']['itens'].each do |item|

app/models/bling_order_item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def value
135135
def synchronize_items
136136
return unless items.empty?
137137

138-
OrderItemsJob.perform_later(self)
138+
OrderItemsJob.perform_later(bling_order_id)
139139
end
140140

141141
def self.bulk_synchronize_items(collection)

0 commit comments

Comments
 (0)