From 93a4f4980ad9317715ad70f23c032d748b3ef4eb Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 18 Apr 2025 18:41:53 +0500 Subject: [PATCH] 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. --- src/ifc5d/ifc5d/csv2ifc.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/ifc5d/ifc5d/csv2ifc.py b/src/ifc5d/ifc5d/csv2ifc.py index 4e7accbbdb..f95758174d 100644 --- a/src/ifc5d/ifc5d/csv2ifc.py +++ b/src/ifc5d/ifc5d/csv2ifc.py @@ -108,7 +108,7 @@ class Csv2Ifc: parents: dict[int, CostItem] = {} 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. min_index = None @@ -126,9 +126,7 @@ class Csv2Ifc: self.has_categories = False # validate header - mandatory_fields = {"Name", "Quantity", "Unit"} - if not self.is_schedule_of_rates: - mandatory_fields.update(non_sor_fields) + mandatory_fields = {"Name", "Unit"} available_fields = set(self.headers.keys()) missing_fields = mandatory_fields - available_fields @@ -142,14 +140,7 @@ class Csv2Ifc: missing_fields.remove("Name") if missing_fields: - if missing_fields == non_sor_fields and not self.is_schedule_of_rates: - 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)}") + raise Exception(f"Missing mandatory fields in CSV header: {', '.join(missing_fields)}") continue cost_data = self.get_row_cost_data(row)