mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Group by unit size is specific: it needs to be divided by scale if not the smallest unit
This commit is contained in:
@@ -161,6 +161,12 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
$scope.getFormattedValueWithUnitName = (value, unitsProduct, unitsVariant, scale) ->
|
||||
unit_name = VariantUnitManager.getUnitName(scale, unitsProduct.variant_unit)
|
||||
$scope.roundToThreeDecimals(value) + " " + unit_name
|
||||
|
||||
$scope.getGroupBySizeFormattedValueWithUnitName = (value, unitsProduct, unitsVariant) ->
|
||||
scale = $scope.getScale(unitsProduct, unitsVariant)
|
||||
if scale
|
||||
value = value / scale if scale != 28.35 && scale != 1 # divide by scale if not smallest unit
|
||||
$scope.getFormattedValueWithUnitName(value, unitsProduct, unitsVariant, scale)
|
||||
else
|
||||
''
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
.three.columns
|
||||
.text-center
|
||||
= t("admin.orders.bulk_management.group_buy_unit_size")
|
||||
.text-center {{ formattedValueWithUnitName( selectedUnitsProduct.group_buy_unit_size, selectedUnitsProduct, selectedUnitsVariant ) }}
|
||||
.text-center {{ getGroupBySizeFormattedValueWithUnitName(selectedUnitsProduct.group_buy_unit_size , selectedUnitsProduct, selectedUnitsVariant ) }}
|
||||
.three.columns
|
||||
.text-center
|
||||
= t("admin.orders.bulk_management.total_qtt_ordered")
|
||||
|
||||
Reference in New Issue
Block a user