Use picked weight for Giant quantity basis
This commit is contained in:
@@ -344,10 +344,11 @@ def derive_prices(item, measure_type, size_value="", size_unit="", pack_qty=""):
|
||||
return price_per_each, price_per_lb, price_per_oz
|
||||
|
||||
|
||||
def derive_normalized_quantity(qty, size_value, size_unit, pack_qty, measure_type):
|
||||
def derive_normalized_quantity(qty, size_value, size_unit, pack_qty, measure_type, picked_weight=""):
|
||||
parsed_qty = to_decimal(qty)
|
||||
parsed_size = to_decimal(size_value)
|
||||
parsed_pack = to_decimal(pack_qty)
|
||||
parsed_picked_weight = to_decimal(picked_weight)
|
||||
total_multiplier = None
|
||||
if parsed_qty not in (None, Decimal("0")):
|
||||
total_multiplier = parsed_qty * (parsed_pack or Decimal("1"))
|
||||
@@ -358,6 +359,8 @@ def derive_normalized_quantity(qty, size_value, size_unit, pack_qty, measure_typ
|
||||
and total_multiplier not in (None, Decimal("0"))
|
||||
):
|
||||
return format_decimal(parsed_size * total_multiplier), size_unit
|
||||
if measure_type == "weight" and parsed_picked_weight not in (None, Decimal("0")):
|
||||
return format_decimal(parsed_picked_weight), "lb"
|
||||
if measure_type == "count" and total_multiplier not in (None, Decimal("0")):
|
||||
return format_decimal(total_multiplier), "count"
|
||||
if measure_type == "each" and parsed_qty not in (None, Decimal("0")):
|
||||
@@ -441,6 +444,7 @@ def parse_item(order_id, order_date, raw_path, line_no, item):
|
||||
size_unit,
|
||||
pack_qty,
|
||||
measure_type,
|
||||
item.get("totalPickedWeight"),
|
||||
)
|
||||
identity_key, normalization_basis = normalization_identity(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user