7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/workers/workarea/orderbot/product/import_parent_products.rb', line 7
def perform
Orderbot::ProductImportData.parent_products.each do |parent_product|
result = begin
Orderbot::ParentProduct.new(parent_product).process
if !parent_product.has_children
Orderbot::ChildProduct.new(parent_product).process
end
true
rescue StandardError => e
parent_product.update_attributes!(error_message: e.message)
false
end
if result
parent_product.delete
end
end
end
|