summaryrefslogtreecommitdiff
path: root/app/Model/ProjectModel.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-08 19:12:16 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-08 19:12:16 -0500
commit58d4231f06fbcbc54573504af2c2a4561b9e89ed (patch)
tree828837dd98873c1e83aac9cdd7a9cd367ec899a3 /app/Model/ProjectModel.php
parent73dce1279760434e1d1b7a903a0a7500462d6f9c (diff)
Improve columns table in project settings
Diffstat (limited to 'app/Model/ProjectModel.php')
-rw-r--r--app/Model/ProjectModel.php34
1 files changed, 3 insertions, 31 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php
index 080217cb..7f9cfb9b 100644
--- a/app/Model/ProjectModel.php
+++ b/app/Model/ProjectModel.php
@@ -262,32 +262,6 @@ class ProjectModel extends Base
}
/**
- * Gather some task metrics for a given project
- *
- * @access public
- * @param integer $project_id Project id
- * @return array
- */
- public function getTaskStats($project_id)
- {
- $stats = array();
- $stats['nb_active_tasks'] = 0;
- $columns = $this->columnModel->getAll($project_id);
- $column_stats = $this->boardModel->getColumnStats($project_id);
-
- foreach ($columns as &$column) {
- $column['nb_active_tasks'] = isset($column_stats[$column['id']]) ? $column_stats[$column['id']] : 0;
- $stats['nb_active_tasks'] += $column['nb_active_tasks'];
- }
-
- $stats['columns'] = $columns;
- $stats['nb_tasks'] = $this->taskFinderModel->countByProjectId($project_id);
- $stats['nb_inactive_tasks'] = $stats['nb_tasks'] - $stats['nb_active_tasks'];
-
- return $stats;
- }
-
- /**
* Get stats for each column of a project
*
* @access public
@@ -296,13 +270,11 @@ class ProjectModel extends Base
*/
public function getColumnStats(array &$project)
{
- $project['columns'] = $this->columnModel->getAll($project['id']);
+ $project['columns'] = $this->columnModel->getAllWithTasksCount($project['id']);
$project['nb_active_tasks'] = 0;
- $stats = $this->boardModel->getColumnStats($project['id']);
- foreach ($project['columns'] as &$column) {
- $column['nb_tasks'] = isset($stats[$column['id']]) ? $stats[$column['id']] : 0;
- $project['nb_active_tasks'] += $column['nb_tasks'];
+ foreach ($project['columns'] as $column) {
+ $project['nb_active_tasks'] += $column['nb_open_tasks'];
}
return $project;