diff --git a/app/models/product_import/entry_validator.rb b/app/models/product_import/entry_validator.rb index 3433ce748c..f720af4aa5 100644 --- a/app/models/product_import/entry_validator.rb +++ b/app/models/product_import/entry_validator.rb @@ -161,7 +161,7 @@ module ProductImport end def unit_fields_validation(entry) - unit_types = ['g', 'oz', 'lb', 'kg', 't', 'ml', 'l', 'kl', ''] + unit_types = ['mg', 'g', 'kg', 'oz', 'lb', 't', 'ml', 'cl', 'dl', 'l', 'kl', 'gal', ''] if entry.units.blank? mark_as_invalid(entry, attribute: 'units', diff --git a/app/models/product_import/unit_converter.rb b/app/models/product_import/unit_converter.rb index 88cd408d34..33e3ac43cf 100644 --- a/app/models/product_import/unit_converter.rb +++ b/app/models/product_import/unit_converter.rb @@ -32,14 +32,18 @@ module ProductImport def unit_scales { + 'mg' => { scale: 0.001, unit: 'weight' }, 'g' => { scale: 1, unit: 'weight' }, 'kg' => { scale: 1000, unit: 'weight' }, 'oz' => { scale: 28.35, unit: 'weight' }, 'lb' => { scale: 453.6, unit: 'weight' }, 't' => { scale: 1_000_000, unit: 'weight' }, 'ml' => { scale: 0.001, unit: 'volume' }, + 'cl' => { scale: 0.01, unit: 'volume' }, + 'dl' => { scale: 0.1, unit: 'volume' }, 'l' => { scale: 1, unit: 'volume' }, - 'kl' => { scale: 1000, unit: 'volume' } + 'kl' => { scale: 1000, unit: 'volume' }, + 'gal' => { scale: 4.54609, unit: 'volume' }, } end