mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix bug in date calculations when editing task times without sufficient data
This commit is contained in:
@@ -88,6 +88,26 @@ class TestEditTaskTime(test.bootstrap.IFC4):
|
||||
assert task_time.ScheduleFinish is None
|
||||
assert task_time.ScheduleDuration is None
|
||||
|
||||
def test_editing_just_a_start_date_with_no_duration_or_finish_but_with_a_calendar(self):
|
||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||
calendar = ifcopenshell.api.run("sequence.add_work_calendar", self.file)
|
||||
task = self.file.createIfcTask()
|
||||
ifcopenshell.api.run("control.assign_control", self.file, relating_control=calendar, related_object=task)
|
||||
task_time = ifcopenshell.api.run("sequence.add_task_time", self.file, task=task)
|
||||
ifcopenshell.api.run(
|
||||
"sequence.edit_task_time",
|
||||
self.file,
|
||||
task_time=task_time,
|
||||
attributes={
|
||||
"ScheduleDuration": None,
|
||||
"ScheduleStart": datetime.datetime(2000, 1, 1),
|
||||
"ScheduleFinish": None,
|
||||
},
|
||||
)
|
||||
assert task_time.ScheduleStart == "2000-01-01T00:00:00"
|
||||
assert task_time.ScheduleFinish is None
|
||||
assert task_time.ScheduleDuration is None
|
||||
|
||||
def test_schedule_finish_dates_are_auto_calculated_if_possible(self):
|
||||
task_time = ifcopenshell.api.run("sequence.add_task_time", self.file, task=self.file.createIfcTask())
|
||||
ifcopenshell.api.run(
|
||||
|
||||
Reference in New Issue
Block a user