mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Merge pull request #13310 from mkllnk/reset-products
Fix product reset on import
This commit is contained in:
@@ -37,8 +37,10 @@ module Catalog
|
||||
|
||||
def reset_variant_on_hand_and_on_demand(variant)
|
||||
was_on_demand = variant.on_demand
|
||||
variant.on_demand = false
|
||||
# Reset on_hand value first because a negative level wouldn't be valid
|
||||
# with on_demand being false.
|
||||
variant.on_hand = 0
|
||||
variant.on_demand = false
|
||||
variant.on_hand.zero? || was_on_demand
|
||||
end
|
||||
end
|
||||
|
||||
@@ -240,8 +240,6 @@ RSpec.describe "Product Import" do
|
||||
end
|
||||
|
||||
it "can reset product stock to zero for products not present in the CSV" do
|
||||
pending("#12933")
|
||||
|
||||
csv_data = <<~CSV
|
||||
name, producer, category, on_hand, price, units, unit_type, shipping_category_id
|
||||
Carrots, User Enterprise, Vegetables, 500, 3.20, 500, g, #{shipping_category_id_str}
|
||||
|
||||
Reference in New Issue
Block a user