fix cost value calculation when using parent cost

This commit is contained in:
Sigma Dimensions (Yass)
2024-01-04 09:30:27 +01:00
parent a96d6dacc7
commit cd6246c382
@@ -108,7 +108,7 @@ class Usecase:
for resource in resources:
cost, unit = ifcopenshell.util.resource.get_cost(resource)
if not cost:
cost = ifcopenshell.util.resource.get_parent_cost(resource) # Concept to standardise - Not defined in schema, but this makes manual scheduling of resources 10x faster and less duplicate data.
cost, unit = ifcopenshell.util.resource.get_parent_cost(resource) # Concept to standardise - Not defined in schema, but this makes manual scheduling of resources 10x faster and less duplicate data.
quantity = ifcopenshell.util.resource.get_quantity(resource)
if not cost or not quantity:
continue
@@ -117,4 +117,4 @@ class Usecase:
total_cost += cost * quantity
if total_cost:
cost_value = ifcopenshell.api.run("cost.add_cost_value", self.file, parent=self.settings["cost_item"])
cost_value.AppliedValue = self.file.createIfcMonetaryMeasure(total_cost)
cost_value.AppliedValue = self.file.createIfcMonetaryMeasure(total_cost)