Improve dashboard
This commit is contained in:
@@ -303,6 +303,27 @@ class ProjectModel extends Base
|
||||
return $projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project summary for a list of project
|
||||
*
|
||||
* @access public
|
||||
* @param array $project_ids List of project id
|
||||
* @return \PicoDb\Table
|
||||
*/
|
||||
public function getQueryColumnStats(array $project_ids)
|
||||
{
|
||||
if (empty($project_ids)) {
|
||||
return $this->db->table(ProjectModel::TABLE)->eq(ProjectModel::TABLE.'.id', 0);
|
||||
}
|
||||
|
||||
return $this->db
|
||||
->table(ProjectModel::TABLE)
|
||||
->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name')
|
||||
->join(UserModel::TABLE, 'id', 'owner_id')
|
||||
->in(self::TABLE.'.id', $project_ids)
|
||||
->callback(array($this, 'applyColumnStats'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query for list of project without column statistics
|
||||
*
|
||||
|
||||
@@ -88,6 +88,15 @@ class SubtaskModel extends Base
|
||||
->asc(self::TABLE.'.position');
|
||||
}
|
||||
|
||||
public function countByAssigneeAndTaskStatus($userId)
|
||||
{
|
||||
return $this->db->table(self::TABLE)
|
||||
->eq('user_id', $userId)
|
||||
->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
|
||||
->join(Taskmodel::TABLE, 'id', 'task_id')
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all subtasks for a given task
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user