mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-22 00:57:26 +00:00
Do not set unit value or description on variant when unpacked field is undefined
This commit is contained in:
@@ -295,10 +295,11 @@ productsApp.controller "AdminBulkProductsCtrl", [
|
||||
|
||||
|
||||
$scope.packVariant = (variant) ->
|
||||
match = variant.unit_value_with_description.match(/^([\d\.]+|)( |)(.*)$/)
|
||||
if match
|
||||
variant.unit_value = parseFloat(match[1]) || null
|
||||
variant.unit_description = match[3]
|
||||
if variant.hasOwnProperty("unit_value_with_description")
|
||||
match = variant.unit_value_with_description.match(/^([\d\.]+|)( |)(.*)$/)
|
||||
if match
|
||||
variant.unit_value = parseFloat(match[1]) || null
|
||||
variant.unit_description = match[3]
|
||||
|
||||
|
||||
$scope.productsWithoutDerivedAttributes = ->
|
||||
|
||||
Reference in New Issue
Block a user