mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Revert ddd7dff75e
I guess after all it's not very reliable idea since it's possible to have a cost schedule without quantities (even non-SoR) and it's giving users false assumptions that they don't need to worry about "Is Schedule of Rates" flag in some cases.
This commit is contained in:
@@ -108,7 +108,7 @@ class Csv2Ifc:
|
|||||||
|
|
||||||
parents: dict[int, CostItem] = {}
|
parents: dict[int, CostItem] = {}
|
||||||
locale.setlocale(locale.LC_ALL, "") # set the system locale
|
locale.setlocale(locale.LC_ALL, "") # set the system locale
|
||||||
non_sor_fields = {"Property", "Query"}
|
non_sor_fields = {"Quantity", "Property", "Query"}
|
||||||
|
|
||||||
# TODO: 25-04-17 Deprecated 0 indices, should fully remove later.
|
# TODO: 25-04-17 Deprecated 0 indices, should fully remove later.
|
||||||
min_index = None
|
min_index = None
|
||||||
@@ -126,9 +126,7 @@ class Csv2Ifc:
|
|||||||
self.has_categories = False
|
self.has_categories = False
|
||||||
|
|
||||||
# validate header
|
# validate header
|
||||||
mandatory_fields = {"Name", "Quantity", "Unit"}
|
mandatory_fields = {"Name", "Unit"}
|
||||||
if not self.is_schedule_of_rates:
|
|
||||||
mandatory_fields.update(non_sor_fields)
|
|
||||||
available_fields = set(self.headers.keys())
|
available_fields = set(self.headers.keys())
|
||||||
missing_fields = mandatory_fields - available_fields
|
missing_fields = mandatory_fields - available_fields
|
||||||
|
|
||||||
@@ -142,14 +140,7 @@ class Csv2Ifc:
|
|||||||
missing_fields.remove("Name")
|
missing_fields.remove("Name")
|
||||||
|
|
||||||
if missing_fields:
|
if missing_fields:
|
||||||
if missing_fields == non_sor_fields and not self.is_schedule_of_rates:
|
raise Exception(f"Missing mandatory fields in CSV header: {', '.join(missing_fields)}")
|
||||||
self.is_schedule_of_rates = True
|
|
||||||
print(
|
|
||||||
"WARNING. Assumed the imported cost schedule is a schedule of rates "
|
|
||||||
f"because the following fields are missing: {', '.join(non_sor_fields)}."
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
raise Exception(f"Missing mandatory fields in CSV header: {', '.join(missing_fields)}")
|
|
||||||
|
|
||||||
continue
|
continue
|
||||||
cost_data = self.get_row_cost_data(row)
|
cost_data = self.get_row_cost_data(row)
|
||||||
|
|||||||
Reference in New Issue
Block a user