mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Extract unit_value_with_description into unit_description only when a string starting with a number is provided
This commit is contained in:
@@ -419,7 +419,7 @@ productEditModule.controller "AdminProductEditCtrl", [
|
||||
|
||||
$scope.packVariant = (product, variant) ->
|
||||
if variant.hasOwnProperty("unit_value_with_description")
|
||||
match = variant.unit_value_with_description.match(/^([\d\.]+|)( |)(.*)$/)
|
||||
match = variant.unit_value_with_description.match(/^([\d\.]+(?= |$)|)( |)(.*)$/)
|
||||
if match
|
||||
product = $scope.findProduct(product.id)
|
||||
variant.unit_value = parseFloat(match[1])
|
||||
|
||||
Reference in New Issue
Block a user