Skip to content

Commit

Permalink
Hide qty 0 additional components from BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Ruhland (hatchery) committed Dec 12, 2022
1 parent 02b97bf commit 1b17290
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wireviz/wv_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def get_additional_component_table(harness: "Harness", component: Union[Connecto
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,
Expand All @@ -47,7 +48,8 @@ def get_additional_component_table(harness: "Harness", component: Union[Connecto
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,
'qty': part.qty * component.get_qty_multiplier(part.qty_multiplier),
Expand Down

0 comments on commit 1b17290

Please sign in to comment.