From bb8b4c0e36afc05ff5b0cb3ac6465351a696b001 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 5 Jul 2015 16:07:21 -0400 Subject: Add task analytics --- app/Model/Transition.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/Model/Transition.php') 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 @@ -38,6 +38,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 * -- cgit v1.2.3