summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Model/SubtaskModel.php15
-rw-r--r--doc/en_US/plugin-hooks.markdown1
2 files changed, 13 insertions, 3 deletions
diff --git a/app/Model/SubtaskModel.php b/app/Model/SubtaskModel.php
index 1e652ae2..626ccbef 100644
--- a/app/Model/SubtaskModel.php
+++ b/app/Model/SubtaskModel.php
@@ -88,13 +88,22 @@ class SubtaskModel extends Base
->asc(self::TABLE.'.position');
}
+ /**
+ * Count by assignee and task status.
+ *
+ * @param integer $userId
+ * @return integer
+ */
public function countByAssigneeAndTaskStatus($userId)
{
- return $this->db->table(self::TABLE)
+ $query = $this->db->table(self::TABLE)
->eq('user_id', $userId)
->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
- ->join(Taskmodel::TABLE, 'id', 'task_id')
- ->count();
+ ->join(Taskmodel::TABLE, 'id', 'task_id');
+
+ $this->hook->reference('model:subtask:count:query', $query);
+
+ return $query->count();
}
/**
diff --git a/doc/en_US/plugin-hooks.markdown b/doc/en_US/plugin-hooks.markdown
index 54b9f689..09b8936b 100644
--- a/doc/en_US/plugin-hooks.markdown
+++ b/doc/en_US/plugin-hooks.markdown
@@ -144,6 +144,7 @@ List of reference hooks:
| `model:color:get-list` | Alter default_colors values |
| `model:subtask:modification:prepare` | Alter form values before to save a subtask |
| `model:subtask:creation:prepare` | Alter form values before to edit a subtask |
+| `model:subtask:count:query` | Alter database query for subtask count |
Template Hooks