summaryrefslogtreecommitdiff
path: root/app/Model/Transition.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-05 16:07:21 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-05 16:07:21 -0400
commitbb8b4c0e36afc05ff5b0cb3ac6465351a696b001 (patch)
treee7499d04cfe32ed429413c2bbe0c81c33700d36a /app/Model/Transition.php
parent67b9a56469b406b44cd1baad4445ddb6d707794f (diff)
Add task analytics
Diffstat (limited to 'app/Model/Transition.php')
-rw-r--r--app/Model/Transition.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/Model/Transition.php b/app/Model/Transition.php
index cb759e4a..959b6aca 100644
--- a/app/Model/Transition.php
+++ b/app/Model/Transition.php
@@ -39,6 +39,22 @@ class Transition extends Base
}
/**
+ * Get average time spent by task for each column
+ *
+ * @access public
+ * @param integer $task_id
+ * @return array
+ */
+ public function getAverageTimeSpentByTask($task_id)
+ {
+ return $this->db
+ ->hashtable(self::TABLE)
+ ->groupBy('src_column_id')
+ ->eq('task_id', $task_id)
+ ->getAll('src_column_id', 'SUM(time_spent) AS time_spent');
+ }
+
+ /**
* Get all transitions by task
*
* @access public