diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-17 20:37:14 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-17 20:37:14 -0500 |
commit | 10debb3f6c442f12d77175d7b16d4e633f6e0bca (patch) | |
tree | a2a7809df541da11c5cf622f302b8316c645fb05 /app/Model/SubtaskTimeTracking.php | |
parent | 4ec507724f6028dfd949df9b547e714714ac990b (diff) |
Update task time spent based on subtasks time spent
Diffstat (limited to 'app/Model/SubtaskTimeTracking.php')
-rw-r--r-- | app/Model/SubtaskTimeTracking.php | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index 1e7e252e..8b197c46 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -307,17 +307,13 @@ class SubtaskTimeTracking extends Base ->eq('end', 0) ->findOneColumn('start'); - $time_spent = $this->db - ->table(Subtask::TABLE) - ->eq('id', $subtask_id) - ->findOneColumn('time_spent'); + $subtask = $this->subtask->getById($subtask_id); return $start_time && - $this->db - ->table(Subtask::TABLE) - ->eq('id', $subtask_id) - ->update(array( - 'time_spent' => $time_spent + round((time() - $start_time) / 3600, 1) - )); + $this->subtask->update(array( // Fire the event subtask.update + 'id' => $subtask['id'], + 'time_spent' => $subtask['time_spent'] + round((time() - $start_time) / 3600, 1), + 'task_id' => $subtask['task_id'], + )); } } |