From 848fdf03fb458308528fdeee7dd59da226f8167c Mon Sep 17 00:00:00 2001 From: "Jeremy Ruhland (hatchery)" Date: Sun, 11 Dec 2022 23:59:32 -0800 Subject: [PATCH] Hide qty 0 additional components from BOM --- src/wireviz/wv_bom.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wireviz/wv_bom.py b/src/wireviz/wv_bom.py index 6689d79a..a233eca8 100644 --- a/src/wireviz/wv_bom.py +++ b/src/wireviz/wv_bom.py @@ -35,7 +35,8 @@ def get_additional_component_table( rows = [] if component.additional_components: rows.append(["Additional components"]) - for part in component.additional_components: + # Ignore components that have qty 0 + for part in [part for part in component.additional_components if component.get_qty_multiplier(part.qty_multiplier)]: common_args = { "qty": part.qty * component.get_qty_multiplier(part.qty_multiplier), "unit": part.unit, @@ -63,7 +64,8 @@ def get_additional_component_table( def get_additional_component_bom(component: Union[Connector, Cable]) -> List[BOMEntry]: """Return a list of BOM entries with additional components.""" bom_entries = [] - for part in component.additional_components: + # Ignore components that have qty 0 + for part in [part for part in component.additional_components if component.get_qty_multiplier(part.qty_multiplier)]: bom_entries.append( { "description": part.description,