summaryrefslogtreecommitdiff
path: root/app/Model/SubtaskTimeTracking.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-17 20:37:14 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-17 20:37:14 -0500
commit10debb3f6c442f12d77175d7b16d4e633f6e0bca (patch)
treea2a7809df541da11c5cf622f302b8316c645fb05 /app/Model/SubtaskTimeTracking.php
parent4ec507724f6028dfd949df9b547e714714ac990b (diff)
Update task time spent based on subtasks time spent
Diffstat (limited to 'app/Model/SubtaskTimeTracking.php')
-rw-r--r--app/Model/SubtaskTimeTracking.php16
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'],
+ ));
}
}