From b9e042dc56c0991d94c322687f0ff6356026e255 Mon Sep 17 00:00:00 2001 From: daitingting Date: Thu, 12 Jul 2018 10:43:17 +0800 Subject: [PATCH] * Adjust computeHours4Multiple function. --- module/task/model.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index 7650b0d96e..d7b5f32f37 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -498,22 +498,36 @@ class taskModel extends model if(isset($task)) { - if($currentTask->left > 0 && $currentTask->consumed > 0 && $oldTask->status == 'wait') $currentTask->status = 'doing'; - if($currentTask->left > 0 && ($currentTask->status == 'done' or $oldTask->status == 'done')) + if($currentTask->consumed == 0) + { + $currentTask->status = 'wait'; + $currentTask->finishedBy = ''; + $currentTask->finishedDate = ''; + } + + if($currentTask->consumed > 0 && $currentTask->left > 0) { $currentTask->status = 'doing'; $currentTask->finishedBy = ''; - $currentTask->finishedDate = '0000-00-00'; + $currentTask->finishedDate = ''; } - if($oldTask->assignedTo != $teams[count($teams) - 1] && isset($team[$currentTask->assignedTo]) && $oldTask->status == 'wait') $currentTask->status = 'doing'; - if($currentTask->left == 0 && $oldTask->left != 0 && $currentTask->consumed != 0) + if($currentTask->consumed > 0 && $currentTask->left == 0) { - if($oldTask->assignedTo == $teams[count($teams) - 1] && $team[$oldTask->assignedTo]->left == 0 && $team[$oldTask->assignedTo]->consumed != 0) + if(isset($team[$currentTask->assignedTo]) && $oldTask->assignedTo != $teams[count($teams) - 1]) { - $currentTask->status = 'done'; - $currentTask->finishedBy = $this->app->user->account; - $currentTask->finishedDate = $now; + $currentTask->status = 'doing'; + $currentTask->finishedBy = ''; + $currentTask->finishedDate = ''; + } + elseif($oldTask->assignedTo == $teams[count($teams) - 1]) + { + $currentTask->status = 'done'; + if($oldTask->left > 0) + { + $currentTask->finishedBy = $this->app->user->account; + $currentTask->finishedDate = $now; + } } }