Fix unfinished time/date/duration handling in edit task time, work plan, work schedule, and finally refactor attribute i/o like I promised

This commit is contained in:
Dion Moult
2021-05-06 17:14:28 +10:00
parent a13b257452
commit 8a3e023408
6 changed files with 177 additions and 403 deletions
@@ -10,10 +10,9 @@ class Usecase:
def execute(self):
for name, value in self.settings["attributes"].items():
if "Start" in name or "Finish" in name or name == "StatusTime":
if value:
if value:
if "Start" in name or "Finish" in name or name == "StatusTime":
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDateTime")
if name == "ScheduleDuration":
if value:
elif name == "ScheduleDuration":
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDuration")
setattr(self.settings["task_time"], name, value)
@@ -1,3 +1,6 @@
import ifcopenshell.util.date
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -7,4 +10,9 @@ class Usecase:
def execute(self):
for name, value in self.settings["attributes"].items():
if value:
if "Date" in name or "Time" in name:
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDateTime")
elif name == "Duration" or name == "TotalFloat":
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDuration")
setattr(self.settings["work_plan"], name, value)
@@ -1,3 +1,6 @@
import ifcopenshell.util.date
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -7,4 +10,9 @@ class Usecase:
def execute(self):
for name, value in self.settings["attributes"].items():
if value:
if "Date" in name or "Time" in name:
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDateTime")
elif name == "Duration" or name == "TotalFloat":
value = ifcopenshell.util.date.datetime2ifc(value, "IfcDuration")
setattr(self.settings["work_schedule"], name, value)