diff options
Diffstat (limited to 'app/Model/SubtaskTimeTracking.php')
-rw-r--r-- | app/Model/SubtaskTimeTracking.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index 9f17ee3f..997031e8 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -301,7 +301,6 @@ class SubtaskTimeTracking extends Base ->findOneColumn('start'); if ($start_time) { - $start = new DateTime; $start->setTimestamp($start_time); @@ -341,18 +340,24 @@ class SubtaskTimeTracking extends Base public function updateTaskTimeTracking($task_id) { $result = $this->calculateSubtaskTime($task_id); + $values = array(); + + if ($result['total_spent'] > 0) { + $values['time_spent'] = $result['total_spent']; + } - if (empty($result['total_spent']) && empty($result['total_estimated'])) { + if ($result['total_estimated'] > 0) { + $values['time_estimated'] = $result['total_estimated']; + } + + if (empty($values)) { return true; } return $this->db ->table(Task::TABLE) ->eq('id', $task_id) - ->update(array( - 'time_spent' => $result['total_spent'], - 'time_estimated' => $result['total_estimated'], - )); + ->update($values); } /** |