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 80b7267e5e
commit bf2027ff96
@@ -108,7 +108,7 @@ class Usecase:
for resource in resources: for resource in resources:
cost, unit = ifcopenshell.util.resource.get_cost(resource) cost, unit = ifcopenshell.util.resource.get_cost(resource)
if not cost: 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) quantity = ifcopenshell.util.resource.get_quantity(resource)
if not cost or not quantity: if not cost or not quantity:
continue continue
@@ -117,4 +117,4 @@ class Usecase:
total_cost += cost * quantity total_cost += cost * quantity
if total_cost: if total_cost:
cost_value = ifcopenshell.api.run("cost.add_cost_value", self.file, parent=self.settings["cost_item"]) 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)