diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-07-23 22:50:20 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-07-23 22:50:20 -0400 |
commit | 5884c65a02a13dd396525d0b8d1720d1c062a96e (patch) | |
tree | c480362ec790adbd2fe331164ac5b5494316e15f /app/Model/SubtaskTimeTrackingModel.php | |
parent | 24555080fd3ca8607f0a798b5a0e4be98ff131f8 (diff) |
Remove SubtaskTimeTrackingSubscriber
Diffstat (limited to 'app/Model/SubtaskTimeTrackingModel.php')
-rw-r--r-- | app/Model/SubtaskTimeTrackingModel.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/Model/SubtaskTimeTrackingModel.php b/app/Model/SubtaskTimeTrackingModel.php index 062e594a..3b1b97e4 100644 --- a/app/Model/SubtaskTimeTrackingModel.php +++ b/app/Model/SubtaskTimeTrackingModel.php @@ -160,6 +160,28 @@ class SubtaskTimeTrackingModel extends Base } /** + * Start or stop timer according to subtask status + * + * @access public + * @param integer $subtask_id + * @param integer $user_id + * @param integer $status + * @return boolean + */ + public function toggleTimer($subtask_id, $user_id, $status) + { + if ($this->configModel->get('subtask_time_tracking') == 1) { + if ($status == SubtaskModel::STATUS_INPROGRESS) { + return $this->subtaskTimeTrackingModel->logStartTime($subtask_id, $user_id); + } elseif ($status == SubtaskModel::STATUS_DONE) { + return $this->subtaskTimeTrackingModel->logEndTime($subtask_id, $user_id); + } + } + + return false; + } + + /** * Log start time * * @access public @@ -252,7 +274,6 @@ class SubtaskTimeTrackingModel extends Base { $subtask = $this->subtaskModel->getById($subtask_id); - // Fire the event subtask.update return $this->subtaskModel->update(array( 'id' => $subtask['id'], 'time_spent' => $subtask['time_spent'] + $time_spent, |