summaryrefslogtreecommitdiff
path: root/app/Model/SubtaskModel.php
diff options
context:
space:
mode:
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;