Don't display "group by size" if value is actually null or empty

+ add spec
This commit is contained in:
Jean-Baptiste Bellet
2023-01-06 14:39:39 +01:00
parent 6b3a0fa14a
commit 2258af9cec
2 changed files with 14 additions and 1 deletions

View File

@@ -219,7 +219,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.getGroupBySizeFormattedValueWithUnitName = (value, unitsProduct, unitsVariant) ->
scale = $scope.getScale(unitsProduct, unitsVariant)
if scale
if scale && value
value = value / scale if scale != 28.35 && scale != 1 && scale != 453.6 # divide by scale if not smallest unit
$scope.getFormattedValueWithUnitName(value, unitsProduct, unitsVariant, scale)
else