summaryrefslogtreecommitdiff
path: root/app/Model/SubtaskModel.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-23 22:50:20 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-23 22:50:20 -0400
commit5884c65a02a13dd396525d0b8d1720d1c062a96e (patch)
treec480362ec790adbd2fe331164ac5b5494316e15f /app/Model/SubtaskModel.php
parent24555080fd3ca8607f0a798b5a0e4be98ff131f8 (diff)
Remove SubtaskTimeTrackingSubscriber
Diffstat (limited to 'app/Model/SubtaskModel.php')
-rw-r--r--app/Model/SubtaskModel.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/Model/SubtaskModel.php b/app/Model/SubtaskModel.php
index 568e27a4..608ffce7 100644
--- a/app/Model/SubtaskModel.php
+++ b/app/Model/SubtaskModel.php
@@ -173,6 +173,7 @@ class SubtaskModel extends Base
$subtask_id = $this->db->table(self::TABLE)->persist($values);
if ($subtask_id !== false) {
+ $this->subtaskTimeTrackingModel->updateTaskTimeTracking($values['task_id']);
$this->queueManager->push($this->subtaskEventJob->withParams($subtask_id, self::EVENT_CREATE));
}
@@ -183,17 +184,21 @@ class SubtaskModel extends Base
* Update
*
* @access public
- * @param array $values Form values
- * @param bool $fire_events If true, will be called an event
+ * @param array $values
+ * @param bool $fire_event
* @return bool
*/
- public function update(array $values, $fire_events = true)
+ public function update(array $values, $fire_event = true)
{
$this->prepare($values);
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values);
- if ($result && $fire_events) {
- $this->queueManager->push($this->subtaskEventJob->withParams($values['id'], self::EVENT_UPDATE, $values));
+ if ($result) {
+ $this->subtaskTimeTrackingModel->updateTaskTimeTracking($values['task_id']);
+
+ if ($fire_event) {
+ $this->queueManager->push($this->subtaskEventJob->withParams($values['id'], self::EVENT_UPDATE, $values));
+ }
}
return $result;