mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Simplify DFC product controller
This commit is contained in:
@@ -20,14 +20,8 @@ module DfcProvider
|
||||
)
|
||||
product = variant.product
|
||||
|
||||
if product.new_record?
|
||||
product.supplier = current_enterprise
|
||||
product.save!
|
||||
end
|
||||
|
||||
if variant.new_record?
|
||||
variant.save!
|
||||
end
|
||||
product.save! if product.new_record?
|
||||
variant.save! if variant.new_record?
|
||||
|
||||
supplied_product = SuppliedProductBuilder.supplied_product(variant)
|
||||
render json: DfcIo.export(supplied_product)
|
||||
|
||||
@@ -35,6 +35,7 @@ class SuppliedProductBuilder < DfcBuilder
|
||||
end
|
||||
else
|
||||
product = import_product(supplied_product)
|
||||
product.supplier = supplier
|
||||
product.ensure_standard_variant
|
||||
product.variants.first
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user