* userModel: remove the unused getPersonalData method.

This commit is contained in:
liugang
2023-12-11 14:55:51 +08:00
parent 680d1a4941
commit f620a37dd4
2 changed files with 5 additions and 48 deletions
+5 -6
View File
@@ -443,12 +443,11 @@ class user extends control
$users = $this->loadModel('dept')->getDeptUserPairs($deptID, 'id');
if(!isset($users[$userID])) $users[$userID] = $user->realname;
$this->view->title = "USER #$user->id $user->account/" . $this->lang->user->profile;
$this->view->groups = $this->loadModel('group')->getByAccount($user->account);
$this->view->deptPath = $this->loadModel('dept')->getParents($user->dept);
$this->view->personalData = $this->user->getPersonalData($user->account);
$this->view->deptUsers = $users;
$this->view->user = $user;
$this->view->title = "USER #$user->id $user->account/" . $this->lang->user->profile;
$this->view->groups = $this->loadModel('group')->getByAccount($user->account);
$this->view->deptPath = $this->loadModel('dept')->getParents($user->dept);
$this->view->deptUsers = $users;
$this->view->user = $user;
$this->display();
}
-42
View File
@@ -2749,48 +2749,6 @@ class userModel extends model
->fetchAll();
}
/**
* Get personal data.
*
* @param string $account
* @access public
* @return array
*/
public function getPersonalData($account = '')
{
if(empty($account)) $account = $this->app->user->account;
$count = 'count(id) AS count';
$t1Count = 'count(t1.id) AS count';
$personalData = array();
$personalData['createdTodos'] = $this->dao->select($count)->from(TABLE_TODO)->where('account')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$personalData['createdRequirements'] = $this->dao->select($t1Count)->from(TABLE_STORY)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.openedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->andWhere('t1.type')->eq('requirement')->fetch('count');
$personalData['createdStories'] = $this->dao->select($t1Count)->from(TABLE_STORY)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.openedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->andWhere('t1.type')->eq('story')->fetch('count');
$personalData['createdBugs'] = $this->dao->select($t1Count)->from(TABLE_BUG)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.openedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count');
$personalData['resolvedBugs'] = $this->dao->select($t1Count)->from(TABLE_BUG)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.resolvedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count');
$personalData['createdCases'] = $this->dao->select($count)->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
if(in_array($this->config->edition, array('max', 'ipd')))
{
$personalData['createdRisks'] = $this->dao->select($t1Count)->from(TABLE_RISK)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.createdBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count');
$personalData['resolvedRisks'] = $this->dao->select($t1Count)->from(TABLE_RISK)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.resolvedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count');
$personalData['createdIssues'] = $this->dao->select($t1Count)->from(TABLE_ISSUE)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.createdBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count');
$personalData['resolvedIssues'] = $this->dao->select($t1Count)->from(TABLE_ISSUE)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.resolvedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count');
}
$personalData['createdDocs'] = $this->dao->select($count)->from(TABLE_DOC)->where('addedBy')->eq($account)->andWhere('lib')->ne('')->andWhere('deleted')->eq('0')->andWhere('vision')->eq($this->config->vision)->fetch('count');
$personalData['finishedTasks'] = $this->dao->select($t1Count)->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')
->leftJoin(TABLE_TASKTEAM)->alias('t3')->on("t1.id = t3.task and t3.account = '{$account}'")
->where('t1.deleted')->eq('0')
->andWhere('t2.deleted')->eq('0')
->andWhere('t1.finishedBy', true)->eq($account)
->orWhere('t3.status')->eq("done")
->markRight(1)
->fetch('count');
return $personalData;
}
/**
* 为 GitLab API 获取用户列表。
* Get user list for GitLab API.