mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 18:22:30 +00:00
Editing task times no longer tries to be clever with actual dates because you know what you're doing.
This commit is contained in:
@@ -38,11 +38,6 @@ class Usecase:
|
|||||||
and "ScheduleFinish" in self.settings["attributes"].keys()
|
and "ScheduleFinish" in self.settings["attributes"].keys()
|
||||||
):
|
):
|
||||||
del self.settings["attributes"]["ScheduleFinish"]
|
del self.settings["attributes"]["ScheduleFinish"]
|
||||||
if (
|
|
||||||
self.settings["attributes"].get("ActualDuration", None)
|
|
||||||
and "ActualFinish" in self.settings["attributes"].keys()
|
|
||||||
):
|
|
||||||
del self.settings["attributes"]["ActualFinish"]
|
|
||||||
|
|
||||||
duration_type = self.settings["attributes"].get("DurationType", self.settings["task_time"].DurationType)
|
duration_type = self.settings["attributes"].get("DurationType", self.settings["task_time"].DurationType)
|
||||||
if "ScheduleFinish" in self.settings["attributes"]:
|
if "ScheduleFinish" in self.settings["attributes"]:
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# IfcOpenShell - IFC toolkit and geometry engine
|
||||||
|
# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of IfcOpenShell.
|
||||||
|
#
|
||||||
|
# IfcOpenShell is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# IfcOpenShell is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import test.bootstrap
|
||||||
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
|
class TestEditTaskTime(test.bootstrap.IFC4):
|
||||||
|
def test_editing_all_attributes(self):
|
||||||
|
task_time = ifcopenshell.api.run("sequence.add_task_time", self.file, task=self.file.createIfcTask())
|
||||||
|
ifcopenshell.api.run("sequence.edit_task_time", self.file, task_time=task_time, attributes={
|
||||||
|
"Name": "Name",
|
||||||
|
"DataOrigin": "NOTDEFINED",
|
||||||
|
"UserDefinedDataOrigin": "UserDefinedDataOrigin",
|
||||||
|
"DurationType": "ELAPSEDTIME",
|
||||||
|
"ScheduleDuration": "P1D",
|
||||||
|
"ScheduleStart": "2000-01-01T00:00:00",
|
||||||
|
"ScheduleFinish": "2000-01-02T00:00:00",
|
||||||
|
"EarlyStart": "2000-01-01T00:00:00",
|
||||||
|
"EarlyFinish": "2000-01-02T00:00:00",
|
||||||
|
"LateStart": "2000-01-01T00:00:00",
|
||||||
|
"LateFinish": "2000-01-02T00:00:00",
|
||||||
|
"FreeFloat": "P0D",
|
||||||
|
"TotalFloat": "P0D",
|
||||||
|
"IsCritical": True,
|
||||||
|
"StatusTime": "2000-01-01T00:00:00",
|
||||||
|
"ActualDuration": "P1D",
|
||||||
|
"ActualStart": "2000-01-01T00:00:00",
|
||||||
|
"ActualFinish": "2000-01-02T00:00:00",
|
||||||
|
"RemainingTime": "P1D",
|
||||||
|
"Completion": 0.5,
|
||||||
|
|
||||||
|
})
|
||||||
|
assert task_time.Name == "Name"
|
||||||
|
assert task_time.DataOrigin == "NOTDEFINED"
|
||||||
|
assert task_time.UserDefinedDataOrigin == "UserDefinedDataOrigin"
|
||||||
|
assert task_time.DurationType == "ELAPSEDTIME"
|
||||||
|
assert task_time.ScheduleDuration == "P1D"
|
||||||
|
assert task_time.ScheduleStart == "2000-01-01T00:00:00"
|
||||||
|
assert task_time.ScheduleFinish == "2000-01-02T00:00:00"
|
||||||
|
assert task_time.EarlyStart == "2000-01-01T00:00:00"
|
||||||
|
assert task_time.EarlyFinish == "2000-01-02T00:00:00"
|
||||||
|
assert task_time.LateStart == "2000-01-01T00:00:00"
|
||||||
|
assert task_time.LateFinish == "2000-01-02T00:00:00"
|
||||||
|
assert task_time.FreeFloat == "P0D"
|
||||||
|
assert task_time.TotalFloat == "P0D"
|
||||||
|
assert task_time.IsCritical == True
|
||||||
|
assert task_time.StatusTime == "2000-01-01T00:00:00"
|
||||||
|
assert task_time.ActualDuration == "P1D"
|
||||||
|
assert task_time.ActualStart == "2000-01-01T00:00:00"
|
||||||
|
assert task_time.ActualFinish == "2000-01-02T00:00:00"
|
||||||
|
assert task_time.RemainingTime == "P1D"
|
||||||
|
assert task_time.Completion == 0.5
|
||||||
Reference in New Issue
Block a user