Improved date calculations during import and editing ensure that start / finish dates are always on working days.

This commit is contained in:
Dion Moult
2021-06-04 15:21:48 +10:00
parent 6f8861c030
commit 8e279ea862
3 changed files with 36 additions and 28 deletions
+10 -10
View File
@@ -70,7 +70,7 @@ class P62Ifc:
exceptions = {}
holiday_or_exceptions = calendar.find("pr:HolidayOrExceptions", self.ns)
holiday_or_exception = []
if holiday_or_exceptions:
if holiday_or_exceptions is not None:
holiday_or_exception = holiday_or_exceptions.findall("pr:HolidayOrException", self.ns)
for exception in holiday_or_exception:
d = datetime.datetime.fromisoformat(exception.find("pr:Date", self.ns).text).date()
@@ -337,6 +337,15 @@ class P62Ifc:
)
task_time = ifcopenshell.api.run("sequence.add_task_time", self.file, task=activity["ifc"])
calendar = self.calendars[activity["CalendarObjectId"]]
# Seems intermittently crashy - can we investigate for larger files?
ifcopenshell.api.run(
"control.assign_control",
self.file,
**{
"relating_control": calendar["ifc"],
"related_object": activity["ifc"],
},
)
ifcopenshell.api.run(
"sequence.edit_task_time",
self.file,
@@ -353,15 +362,6 @@ class P62Ifc:
else None,
},
)
# Seems intermittently crashy - can we investigate for larger files?
ifcopenshell.api.run(
"control.assign_control",
self.file,
**{
"relating_control": calendar["ifc"],
"related_object": activity["ifc"],
},
)
def create_rel_sequences(self):
self.sequence_type_map = {