diff --git a/module/task/test/model/computebeginandend.php b/module/task/test/model/computebeginandend.php index b88da90a68..07b7645c71 100755 --- a/module/task/test/model/computebeginandend.php +++ b/module/task/test/model/computebeginandend.php @@ -2,7 +2,8 @@ config('task_computebeginandend')->gen(10); /** @@ -10,15 +11,13 @@ title=taskModel->computeBeginAndEnd(); cid=1 pid=1 -根据taskID计算没有父计划的开始结束时间 >> 0,6 -根据taskID计算有父计划的父开始结束时间 >> 0,7 -根据不存在的taskID计算开始结束时间 >> 0 - */ -$taskIDList = array('1', '901', '100001'); +$taskIDList = array('1', '2', '3', '4', '100001'); $task = new taskTest(); -r($task->computeBeginAndEndTest($taskIDList[0])) && p('estStartedDiff,deadlineDiff') && e('0,6'); //根据taskID计算没有父计划的开始结束时间 -r($task->computeBeginAndEndTest($taskIDList[1])) && p('estStartedDiff,deadlineDiff') && e('0,7'); //根据taskID计算有父计划的父开始结束时间 -r($task->computeBeginAndEndTest($taskIDList[2])) && p('estStartedDiff,deadlineDiff') && e('0'); //根据不存在的taskID计算开始结束时间 +r($task->computeBeginAndEndTest($taskIDList[0])) && p('estStarted,realStarted,deadline') && e('2021-01-01,2021-01-02 00:00:00,2021-01-03'); //根据taskID计算没有父任务的预计开始 实际开始 截止日期 +r($task->computeBeginAndEndTest($taskIDList[1])) && p('estStarted,realStarted,deadline') && e('2021-01-17,2021-01-18 16:00:00,2021-01-28'); //根据taskID计算有子任务的父任务预计开始 实际开始 截止日期 +r($task->computeBeginAndEndTest($taskIDList[2])) && p('estStarted,realStarted,deadline') && e('2021-01-09,2021-01-10 08:00:00,2021-01-11'); //根据子任务全部取消的父任务的计算预计开始 实际开始 截止日期 +r($task->computeBeginAndEndTest($taskIDList[3])) && p('estStarted,realStarted,deadline') && e('2021-01-13,2021-01-14 12:00:00,2021-01-15'); //根据不存在子任务的父任务的计算预计开始 实际开始 截止日期 +r($task->computeBeginAndEndTest($taskIDList[4])) && p('estStarted,realStarted,deadline') && e('0,0,0'); //根据不存在的taskID计算预计开始 实际开始 截止日期 diff --git a/module/task/test/model/computeworkinghours.php b/module/task/test/model/computeworkinghours.php index 5ebeb0ef76..86d0157a06 100755 --- a/module/task/test/model/computeworkinghours.php +++ b/module/task/test/model/computeworkinghours.php @@ -13,12 +13,13 @@ pid=1 */ -$taskIDList = array(1, 2, 3, 4, 5, 1001); +$taskIDList = array(1, 2, 3, 4, 5, 6, 1001); $task = new taskTest(); -r($task->computeWorkingHoursTest($taskIDList[0])) && p('id,estimate,consumed,left') && e('1,2,0,1'); //根据父taskID更新普通任务的任务工时 -r($task->computeWorkingHoursTest($taskIDList[1])) && p('id,estimate,consumed,left') && e('2,9,6,4'); //根据父taskID更新任务工时 -r($task->computeWorkingHoursTest($taskIDList[2])) && p('id,estimate,consumed,left') && e('3,9,10,6'); //根据父taskID更新父任务取消的任务工时 -r($task->computeWorkingHoursTest($taskIDList[3])) && p('id,estimate,consumed,left') && e('4,9,9,0'); //根据父taskID更新子任务全部关闭的父任务的工时 -r($task->computeWorkingHoursTest($taskIDList[4])) && p('id,estimate,consumed,left') && e('5,3,0,1'); //根据父taskID更新没有子任务的任务工时 -r($task->computeWorkingHoursTest($taskIDList[5])) && p('id,estimate,consumed,left') && e('0,0,0,0'); //根据不存在的taskID计算工时 +r($task->computeWorkingHoursTest($taskIDList[0])) && p('id,estimate,consumed,left') && e('1,2,0,1'); //根据父taskID更新普通任务的任务工时 +r($task->computeWorkingHoursTest($taskIDList[1])) && p('id,estimate,consumed,left') && e('2,9,9,5'); //根据父taskID更新任务工时 +r($task->computeWorkingHoursTest($taskIDList[2])) && p('id,estimate,consumed,left') && e('3,9,8,4'); //根据父taskID更新父任务取消的任务工时 +r($task->computeWorkingHoursTest($taskIDList[3])) && p('id,estimate,consumed,left') && e('4,5,7,0'); //根据父taskID更新子任务全部关闭的父任务的工时 +r($task->computeWorkingHoursTest($taskIDList[4])) && p('id,estimate,consumed,left') && e('5,3,0,1'); //根据父taskID更新子任务全部取消的父任务的工时 +r($task->computeWorkingHoursTest($taskIDList[5])) && p('id,estimate,consumed,left') && e('6,4,0,1'); //根据父taskID更新没有子任务的任务工时 +r($task->computeWorkingHoursTest($taskIDList[6])) && p('id,estimate,consumed,left') && e('0,0,0,0'); //根据不存在的taskID计算工时 diff --git a/module/task/test/model/yaml/computebeginandend/task_computebeginandend.yaml b/module/task/test/model/yaml/computebeginandend/task_computebeginandend.yaml new file mode 100644 index 0000000000..6865aa3e75 --- /dev/null +++ b/module/task/test/model/yaml/computebeginandend/task_computebeginandend.yaml @@ -0,0 +1,23 @@ +--- +title: zt_task +author: auto_computeworkinghours +version: "1.0" +fields: +- field: parent + range: 0,`-1`{3},2{3},3{3} +- field: status + range: wait{2},doing{5},cancel{3} +- field: estStarted + range: "20210101 000000-20220101 230000:360000" + type: timestamp + format: "YY/MM/DD hh:mm:ss" +- field: realStarted + range: "20210102 000000-20220101 230000:360000" + type: timestamp + format: "YY/MM/DD hh:mm:ss" +- field: deadline + range: "20210103 000000-20220101 230000:360000" + type: timestamp + format: "YY/MM/DD hh:mm:ss" +... + diff --git a/module/task/test/model/yaml/computeworkinghours/task_computeworkinghours.yaml b/module/task/test/model/yaml/computeworkinghours/task_computeworkinghours.yaml index e44f47ec7c..43f2bf80e0 100644 --- a/module/task/test/model/yaml/computeworkinghours/task_computeworkinghours.yaml +++ b/module/task/test/model/yaml/computeworkinghours/task_computeworkinghours.yaml @@ -4,14 +4,14 @@ author: auto_computeworkinghours version: "1.0" fields: - field: parent - range: 0,`-1`{4},2{3},3{3},4{3} + range: 0,`-1`{5},2{3},3{3},4{3},5{3} - field: status - range: doing{2},cancel,doing{2},wait,doing,done,wait,doing,done,closed{3} + range: doing{2},cancel,doing{2},wait,doing,done,wait,doing,done,closed{3},cancel{3} - field: consumed range: 1-5 - field: estimate range: 2-4 - field: left - range: 1-4{7},0,1{2},0{10} + range: 1-4{7},0,1{2},0{20} ... diff --git a/module/task/test/task.class.php b/module/task/test/task.class.php index 31ee214a1a..b779413dac 100644 --- a/module/task/test/task.class.php +++ b/module/task/test/task.class.php @@ -878,13 +878,7 @@ class taskTest $object = $this->objectModel->getById($taskID); if(empty($object)) return 0; - - if($object->parent > 0) $object = $this->objectModel->getById($object->parent); - - - $estStartedDiff = date_diff(date_create($object->estStarted), date_create(helper::now())); - $deadlineDiff = date_diff(date_create($object->deadline), date_create(helper::now())); - return array('estStartedDiff' => $estStartedDiff->d, 'deadlineDiff' => $deadlineDiff->d); + return $object; } }