diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-08-12 22:45:59 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-08-12 22:45:59 -0400 |
commit | 7e6309dd7e10c669a6e7615fad40efc564c6f1f1 (patch) | |
tree | 5b0847b685659d70a5db0caf9c7c5dabd39a1657 /app/Model | |
parent | 8d43897e26d0979184978ee731331e051fb086ed (diff) |
Improve bug fix
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/SubtaskTimeTracking.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index 8f8aac94..997031e8 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -340,17 +340,24 @@ class SubtaskTimeTracking extends Base public function updateTaskTimeTracking($task_id) { $result = $this->calculateSubtaskTime($task_id); + $values = array(); - if (empty($result['total_spent']) && empty($result['total_estimated'])) { + if ($result['total_spent'] > 0) { + $values['time_spent'] = $result['total_spent']; + } + + 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) - ->sumColumn('time_spent', $result['total_spent']) - ->sumColumn('time_estimated', $result['total_estimated']) - ->update(); + ->update($values); } /** |