mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
ifc5d: fix two csv2ifc bugs found by round-trip test
ItemIsASum and Quantities are exporter columns that were missing from MAIN_CSV_HEADER_COLUMNS, causing them to be misidentified as numeric cost value categories on re-import. Also initialise rate_cost_schedule to None before the search loop to avoid UnboundLocalError when no match is found. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -68,6 +68,8 @@ MAIN_CSV_HEADER_COLUMNS.extend(
|
|||||||
# Not sure what this for but it's present in sample .csv.
|
# Not sure what this for but it's present in sample .csv.
|
||||||
"Subtotal",
|
"Subtotal",
|
||||||
# Columns from exporter.
|
# Columns from exporter.
|
||||||
|
"ItemIsASum",
|
||||||
|
"Quantities",
|
||||||
"RateSubtotal",
|
"RateSubtotal",
|
||||||
"TotalPrice",
|
"TotalPrice",
|
||||||
# Deprecated columns from exporter, shouldn't be exported any longer.
|
# Deprecated columns from exporter, shouldn't be exported any longer.
|
||||||
@@ -335,6 +337,7 @@ class Csv2Ifc:
|
|||||||
|
|
||||||
if cost_rate.get("Schedule") and cost_rate.get("RateID"):
|
if cost_rate.get("Schedule") and cost_rate.get("RateID"):
|
||||||
# if cost_rate["Schedule"] is not "":
|
# if cost_rate["Schedule"] is not "":
|
||||||
|
rate_cost_schedule = None
|
||||||
schedules = self.file.by_type("IfcCostSchedule")
|
schedules = self.file.by_type("IfcCostSchedule")
|
||||||
for schedule in schedules:
|
for schedule in schedules:
|
||||||
if schedule.Name == cost_rate["Schedule"]:
|
if schedule.Name == cost_rate["Schedule"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user