From 14713b0ec7ed93ca45578da069ad4e19a7d8addf Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 28 May 2016 19:48:22 -0400 Subject: Rename all models --- app/Model/TaskAnalyticModel.php | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 app/Model/TaskAnalyticModel.php (limited to 'app/Model/TaskAnalyticModel.php') diff --git a/app/Model/TaskAnalyticModel.php b/app/Model/TaskAnalyticModel.php new file mode 100644 index 00000000..3d6fe8a8 --- /dev/null +++ b/app/Model/TaskAnalyticModel.php @@ -0,0 +1,72 @@ +columnModel->getList($task['project_id']); + $sums = $this->transitionModel->getTimeSpentByTask($task['id']); + + foreach ($columns as $column_id => $column_title) { + $time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0; + + if ($task['column_id'] == $column_id) { + $time_spent += ($task['date_completed'] ?: time()) - $task['date_moved']; + } + + $result[] = array( + 'id' => $column_id, + 'title' => $column_title, + 'time_spent' => $time_spent, + ); + } + + return $result; + } +} -- cgit v1.2.3