mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
check all variants, not just where we use 'items'
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
class MigrateVariantUnitValues < ActiveRecord::Migration
|
||||
def up
|
||||
Spree::Variant.includes(:product).where(
|
||||
spree_products: { variant_unit: "items" },
|
||||
spree_variants: { unit_value: [nil, Float::NAN] }
|
||||
).find_each do |variant|
|
||||
Spree::Variant.where(unit_value: [nil, Float::NAN]).find_each do |variant|
|
||||
variant.unit_value = 1
|
||||
variant.save
|
||||
end
|
||||
Spree::Variant.includes(:product).where(
|
||||
spree_products: { variant_unit: "items" },
|
||||
spree_variants: { weight: [nil, Float::NAN] }
|
||||
).find_each do |variant|
|
||||
Spree::Variant.where(weight: [nil, Float::NAN]).find_each do |variant|
|
||||
variant.weight = 0
|
||||
variant.save
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user