summaryrefslogtreecommitdiff
path: root/app/Model/Project.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-10 16:21:47 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-10 16:21:47 +0200
commit28ff8dad91c9e3c25f6a3b5398ae15f2a1ef95cd (patch)
tree0cecc5cbb6e7e6795dd032cc6a5703cd88b8770e /app/Model/Project.php
parent9bde377bbe85617dde280af985e033cf7de61803 (diff)
Add subtasks and comments history
Diffstat (limited to 'app/Model/Project.php')
-rw-r--r--app/Model/Project.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/app/Model/Project.php b/app/Model/Project.php
index 1da5c164..9aef3c7e 100644
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -720,7 +720,25 @@ class Project extends Base
*/
public function getActivity($project_id)
{
- // TODO: merge comments and subtasks activity
- return $this->taskHistory->getAllContentByProjectId($project_id);
+ $activity = array();
+ $tasks = $this->taskHistory->getAllContentByProjectId($project_id, 25);
+ $comments = $this->commentHistory->getAllContentByProjectId($project_id, 25);
+ $subtasks = $this->subtaskHistory->getAllContentByProjectId($project_id, 25);
+
+ foreach ($tasks as &$task) {
+ $activity[$task['date_creation'].'-'.$task['id']] = $task;
+ }
+
+ foreach ($subtasks as &$subtask) {
+ $activity[$subtask['date_creation'].'-'.$subtask['id']] = $subtask;
+ }
+
+ foreach ($comments as &$comment) {
+ $activity[$comment['date_creation'].'-'.$comment['id']] = $comment;
+ }
+
+ krsort($activity);
+
+ return $activity;
}
}