fix error exporting schedule of rates #4723

Issue occurred when cost item would have no quantities but had controlled objects with quantities.

1) just added a check to ensure that cost_item.CostQuantities are present
2) removed possible None return value in get_cost_item_quantity as it actually will break process_cost_data and it's never used anywhere else
3) has_changed_name was unused
4) fix possible similar issue in cost.data (though _get_object_quantities method is unused)
This commit is contained in:
Andrej730
2024-05-29 11:49:27 +05:00
parent f4247c3527
commit ab1bf7592e
2 changed files with 19 additions and 17 deletions
@@ -202,6 +202,9 @@ class CostSchedulesData:
def _get_object_quantities(cls, cost_item, element):
if not element.is_a("IfcObject"):
return []
cost_quantities = cost_item.CostQuantities
if not cost_quantities:
return []
results = []
for relationship in element.IsDefinedBy:
if not relationship.is_a("IfcRelDefinesByProperties"):
@@ -210,7 +213,7 @@ class CostSchedulesData:
if not qto.is_a("IfcElementQuantity"):
continue
for prop in qto.Quantities:
if prop in cost_item.CostQuantities or []:
if prop in cost_quantities:
results.append(prop.id())
return results