From 1d42ce04eb96efd3330695cecfaa8d7b9f701c08 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 10 Aug 2021 10:55:01 +1000 Subject: [PATCH] Fix bug where editing a schedule finish date by itself wouldn't work --- src/ifcopenshell-python/ifcopenshell/api/resource/data.py | 4 ++++ .../ifcopenshell/api/resource/edit_resource_time.py | 4 ++-- .../ifcopenshell/api/sequence/edit_task_time.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/data.py b/src/ifcopenshell-python/ifcopenshell/api/resource/data.py index 99a989ccec..b917e18920 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/resource/data.py +++ b/src/ifcopenshell-python/ifcopenshell/api/resource/data.py @@ -1,3 +1,7 @@ +import ifcopenshell +import ifcopenshell.util.date + + class Data: is_loaded = False resources = {} diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py index 9a959f3f58..b56d8c2947 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py +++ b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py @@ -14,12 +14,12 @@ class Usecase: # If the user specifies both an end date and a duration, the duration takes priority if ( - "ScheduleWork" in self.settings["attributes"].keys() + self.settings["attributes"].get("ScheduleWork", None) and "ScheduleFinish" in self.settings["attributes"].keys() ): del self.settings["attributes"]["ScheduleFinish"] if ( - "ActualWork" in self.settings["attributes"].keys() + self.settings["attributes"].get("ActualWork", None) and "ActualFinish" in self.settings["attributes"].keys() ): del self.settings["attributes"]["ActualFinish"] diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py index f332265eb9..9204323477 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py @@ -16,12 +16,12 @@ class Usecase: # If the user specifies both an end date and a duration, the duration takes priority if ( - "ScheduleDuration" in self.settings["attributes"].keys() + self.settings["attributes"].get("ScheduleDuration", None) and "ScheduleFinish" in self.settings["attributes"].keys() ): del self.settings["attributes"]["ScheduleFinish"] if ( - "ActualDuration" in self.settings["attributes"].keys() + self.settings["attributes"].get("ActualDuration", None) and "ActualFinish" in self.settings["attributes"].keys() ): del self.settings["attributes"]["ActualFinish"]