diff --git a/app/assets/javascripts/admin/products/services/variant_unit_manager.js.coffee b/app/assets/javascripts/admin/products/services/variant_unit_manager.js.coffee index 845827adc4..f54b9bcbb1 100644 --- a/app/assets/javascripts/admin/products/services/variant_unit_manager.js.coffee +++ b/app/assets/javascripts/admin/products/services/variant_unit_manager.js.coffee @@ -4,15 +4,9 @@ angular.module("admin.products").factory "VariantUnitManager", -> 'weight': 1.0: 'g' 1000.0: 'kg' - 1000000.0: 'T', - # This appears to be what needs to be set in order for - # products to have a mass value stored in the database - # when they are created. However, it does not appear to - # change the existing product(s), so if the scale value - # is changed, a data migration may be necessary to make sure - # the proper unit X to grams actually works. - # TODO: ^^^ Delete this - 453.592: 'lb' + 1000000.0: 'T' + 453.6: 'lb' + 28.34952: 'oz' 'volume': 0.001: 'mL' 1.0: 'L' diff --git a/app/models/product_import/unit_converter.rb b/app/models/product_import/unit_converter.rb index c7e5464329..f9467f4ac5 100644 --- a/app/models/product_import/unit_converter.rb +++ b/app/models/product_import/unit_converter.rb @@ -32,10 +32,8 @@ module ProductImport { 'g' => { scale: 1, unit: 'weight' }, 'kg' => { scale: 1000, unit: 'weight' }, - # We have _no idea_ what this is doing. It has units? - # And it maybe is connected to something related to shipping? - # TODO: DELETE THIS ^^^ - 'lb' => { scale: 453.592, unit: 'weight' }, + 'oz' => { scale: 28.34952, unit: 'weight' }, + 'lb' => { scale: 453.6, unit: 'weight' }, 't' => { scale: 1_000_000, unit: 'weight' }, 'ml' => { scale: 0.001, unit: 'volume' }, 'l' => { scale: 1, unit: 'volume' }, diff --git a/lib/open_food_network/option_value_namer.rb b/lib/open_food_network/option_value_namer.rb index 896412856a..4a2f18010f 100644 --- a/lib/open_food_network/option_value_namer.rb +++ b/lib/open_food_network/option_value_namer.rb @@ -71,7 +71,7 @@ module OpenFoodNetwork # shop or producer basis? units = { 'weight' => { 1.0 => 'g', 1000.0 => 'kg', 1_000_000.0 => 'T', - 28.34952 => 'oz', 453.59237 => 'lb'}, + 28.34952 => 'oz', 453.6 => 'lb'}, 'volume' => { 0.001 => 'mL', 1.0 => 'L', 1000.0 => 'kL' } } # Find the largest available unit where unit_value comes to >= 1 when expressed in it.