From 20a09be88e08d708103af998f6217a91c989fec3 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Tue, 1 Sep 2020 15:47:03 +0800 Subject: [PATCH] * Finish task #7734. --- module/block/control.php | 2 +- module/block/lang/zh-cn.php | 50 +++++++++++++-------------- module/block/model.php | 25 -------------- module/block/view/contribute.html.php | 20 +++++------ module/my/control.php | 1 + module/my/view/testcase.html.php | 25 ++++++++++++-- module/user/model.php | 15 +++++--- 7 files changed, 69 insertions(+), 69 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 0cb08a9091..178fc2afab 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -321,7 +321,7 @@ class block extends control */ public function contribute() { - $this->view->data = $this->block->getContributeBlockData(); + $this->view->data = $this->loadModel('user')->getPersonalData(); $this->display(); } diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index b51103a0d4..d6703381c6 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -38,31 +38,31 @@ $lang->block->welcome = '欢迎总览'; $lang->block->lblTesttask = '查看测试详情'; $lang->block->contribute = '我的贡献'; -$lang->block->leftToday = '今天剩余工作总计'; -$lang->block->myTask = '我的任务'; -$lang->block->myStory = "我的{$lang->storyCommon}"; -$lang->block->myBug = '我的BUG'; -$lang->block->myProject = '未关闭的' . $lang->projectCommon; -$lang->block->myProduct = '未关闭的' . $lang->productCommon; -$lang->block->delayed = '已延期'; -$lang->block->noData = '当前统计类型下暂无数据'; -$lang->block->emptyTip = '暂无信息'; -$lang->block->openedTodos = '创建的待办数'; -$lang->block->openedStories = '创建的需求数'; -$lang->block->resolvedTasks = '完成的任务数'; -$lang->block->resolvedBugs = '解决Bug数'; -$lang->block->openedTestcases = '创建用例数'; -$lang->block->waterfall = 'CMMI 3'; -$lang->block->scrum = 'Scrum+'; -$lang->block->allProject = '所有' . $lang->projectCommon; -$lang->block->doingProject = '进行中的' . $lang->projectCommon; -$lang->block->finishProject = '累积' . $lang->projectCommon; -$lang->block->estimatedHours = '预计工时'; -$lang->block->consumedHours = '已消耗'; -$lang->block->time = '第'; -$lang->block->week = '周'; -$lang->block->month = '月'; -$lang->block->selectProduct = '选择产品'; +$lang->block->leftToday = '今天剩余工作总计'; +$lang->block->myTask = '我的任务'; +$lang->block->myStory = "我的{$lang->storyCommon}"; +$lang->block->myBug = '我的BUG'; +$lang->block->myProject = '未关闭的' . $lang->projectCommon; +$lang->block->myProduct = '未关闭的' . $lang->productCommon; +$lang->block->delayed = '已延期'; +$lang->block->noData = '当前统计类型下暂无数据'; +$lang->block->emptyTip = '暂无信息'; +$lang->block->createdTodo = '创建的待办数'; +$lang->block->createdStory = '创建的软件需求数'; +$lang->block->finishedTask = '完成的任务数'; +$lang->block->resolvedBug = '解决的Bug数'; +$lang->block->createdCase = '创建的用例数'; +$lang->block->waterfall = 'CMMI 3'; +$lang->block->scrum = 'Scrum+'; +$lang->block->allProject = '所有' . $lang->projectCommon; +$lang->block->doingProject = '进行中的' . $lang->projectCommon; +$lang->block->finishProject = '累积' . $lang->projectCommon; +$lang->block->estimatedHours = '预计工时'; +$lang->block->consumedHours = '已消耗'; +$lang->block->time = '第'; +$lang->block->week = '周'; +$lang->block->month = '月'; +$lang->block->selectProduct = '选择产品'; $lang->block->params = new stdclass(); $lang->block->params->name = '参数名称'; diff --git a/module/block/model.php b/module/block/model.php index 3ddb2e3438..29417ce489 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -212,31 +212,6 @@ class blockModel extends model return $data; } - /** - * Get contribute block data. - * - * @access public - * @return array - */ - public function getContributeBlockData() - { - $account = $this->app->user->account; - $count = 'count(*) AS count'; - - $data = array(); - $data['todos'] = $this->dao->select($count)->from(TABLE_TODO)->where('account')->eq($account)->fetch('count'); - $data['stories'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $data['bugs'] = $this->dao->select($count)->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $data['cases'] = $this->dao->select($count)->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('product')->ne(0)->fetch('count'); - $data['tasks'] = $this->dao->select($count)->from(TABLE_TASK)->where('deleted')->eq('0') - ->andWhere('finishedBy', true)->eq($account) - ->orWhere('finishedList')->like("%,{$account},%") - ->markRight(1) - ->fetch('count'); - - return $data; - } - /** * Init block when account use first. * diff --git a/module/block/view/contribute.html.php b/module/block/view/contribute.html.php index 58dc927881..f64d7207b0 100644 --- a/module/block/view/contribute.html.php +++ b/module/block/view/contribute.html.php @@ -3,24 +3,24 @@
-
block->openedTodos?>
-
createLink('my', 'todo', 'type=all'), (int)$data['todos']);?>
+
block->createdTodo;?>
+
createLink('my', 'todo', 'type=all'), (int)$data['createdTodo']);?>
-
block->openedStories?>
-
createLink('my', 'story', 'type=openedBy'), (int)$data['stories']);?>
+
block->createdStory;?>
+
createLink('my', 'story', 'type=openedBy'), (int)$data['createdStory']);?>
-
block->resolvedTasks?>
-
createLink('my', 'task', 'type=finishedBy'), (int)$data['tasks']);?>
+
block->finishedTask;?>
+
createLink('my', 'task', 'type=finishedBy'), (int)$data['finishedTask']);?>
-
block->resolvedBugs?>
-
createLink('my', 'bug', 'type=resolvedBy'), (int)$data['bugs']);?>
+
block->resolvedBug;?>
+
createLink('my', 'bug', 'type=resolvedBy'), (int)$data['resolvedBug']);?>
-
block->openedTestcases?>
-
createLink('my', 'testcase', 'type=openedbyme'), (int)$data['cases']);?>
+
block->createdCase;?>
+
createLink('my', 'testcase', 'type=openedbyme'), (int)$data['createdCase']);?>
diff --git a/module/my/control.php b/module/my/control.php index 7e39baab0d..95775dd47b 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -369,6 +369,7 @@ class my extends control $this->view->users = $this->user->getPairs('noletter'); $this->view->tabID = 'test'; $this->view->type = $type; + $this->view->summary = $this->testcase->summary($cases); $this->view->recTotal = $recTotal; $this->view->recPerPage = $recPerPage; $this->view->pageID = $pageID; diff --git a/module/my/view/testcase.html.php b/module/my/view/testcase.html.php index 9fee7ebd3b..9dcaef3658 100644 --- a/module/my/view/testcase.html.php +++ b/module/my/view/testcase.html.php @@ -40,12 +40,14 @@ app->loadLang('testtask'); - $canBatchEdit = common::hasPriv('testcase', 'batchEdit'); - $canBatchRun = common::hasPriv('testtask', 'batchRun'); + $canBatchRun = common::hasPriv('testtask', 'batchRun'); + $canBatchEdit = common::hasPriv('testcase', 'batchEdit'); + $canBatchAction = ($canBatchRun or $canBatchEdit); ?> + selectAll}'>";?> idAB);?> priAB);?> @@ -67,7 +69,7 @@ ?> - id);?> + id => '')) . html::a(helper::createLink('testcase', 'view', "caseID =$case->id"), sprintf('%03d', $case->id)); ?> pri?>' title='testcase->priList, $case->pri, $case->pri);?>'>testcase->priList, $case->pri, $case->pri)?> version";?> @@ -93,6 +95,23 @@ diff --git a/module/user/model.php b/module/user/model.php index 88efbbd8f8..75c087e95c 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1853,13 +1853,18 @@ class userModel extends model public function getPersonalData($account = '') { if(empty($account)) $account = $this->app->user->account; + $count = 'count(*) AS count'; $personalData = array(); - $personalData['createdTodo'] = $this->dao->select('count(*) as count')->from(TABLE_TODO)->where('account')->eq($account)->fetch('count'); - $personalData['createdStory'] = $this->dao->select('count(*) as count')->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('type')->eq('story')->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['finishedTask'] = $this->dao->select('count(*) as count')->from(TABLE_TASK)->where('finishedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['resolvedBug'] = $this->dao->select('count(*) as count')->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['createdCase'] = $this->dao->select('count(*) as count')->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); + $personalData['createdTodo'] = $this->dao->select($count)->from(TABLE_TODO)->where('account')->eq($account)->fetch('count'); + $personalData['createdStory'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); + $personalData['resolvedBug'] = $this->dao->select($count)->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); + $personalData['createdCase'] = $this->dao->select($count)->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('product')->ne(0)->fetch('count'); + $personalData['finishedTask'] = $this->dao->select($count)->from(TABLE_TASK)->where('deleted')->eq('0') + ->andWhere('finishedBy', true)->eq($account) + ->orWhere('finishedList')->like("%,{$account},%") + ->markRight(1) + ->fetch('count'); return $personalData; }