summaryrefslogtreecommitdiff
path: root/app/Model/Subtask.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Subtask.php')
-rw-r--r--app/Model/Subtask.php39
1 files changed, 1 insertions, 38 deletions
diff --git a/app/Model/Subtask.php b/app/Model/Subtask.php
index 1d5ed566..048594bd 100644
--- a/app/Model/Subtask.php
+++ b/app/Model/Subtask.php
@@ -176,9 +176,6 @@ class Subtask extends Base
$subtask_id = $this->persist(self::TABLE, $values);
if ($subtask_id) {
-
- $this->updateTaskTimeTracking($values['task_id']);
-
$this->container['dispatcher']->dispatch(
self::EVENT_CREATE,
new SubtaskEvent(array('id' => $subtask_id) + $values)
@@ -202,10 +199,6 @@ class Subtask extends Base
if ($result) {
- if (isset($values['task_id'])) {
- $this->updateTaskTimeTracking($values['task_id']);
- }
-
$this->container['dispatcher']->dispatch(
self::EVENT_UPDATE,
new SubtaskEvent($values)
@@ -231,6 +224,7 @@ class Subtask extends Base
$values = array(
'id' => $subtask['id'],
'status' => ($subtask['status'] + 1) % 3,
+ 'task_id' => $subtask['task_id'],
);
return $this->update($values);
@@ -268,37 +262,6 @@ class Subtask extends Base
}
/**
- * Update task time tracking based on subtasks time tracking
- *
- * @access public
- * @param integer $task_id Task id
- * @return bool
- */
- public function updateTaskTimeTracking($task_id)
- {
- $result = $this->db
- ->table(self::TABLE)
- ->eq('task_id', $task_id)
- ->columns(
- 'SUM(time_spent) AS total_spent',
- 'SUM(time_estimated) AS total_estimated'
- )
- ->findOne();
-
- if (empty($result['total_spent']) && empty($result['total_estimated'])) {
- return true;
- }
-
- return $this->db
- ->table(Task::TABLE)
- ->eq('id', $task_id)
- ->update(array(
- 'time_spent' => $result['total_spent'],
- 'time_estimated' => $result['total_estimated'],
- ));
- }
-
- /**
* Remove
*
* @access public