* Optimize execution all page.

This commit is contained in:
Lufei
2023-06-09 13:24:02 +08:00
parent 13a6032324
commit 61d72abd9f
3 changed files with 23 additions and 24 deletions

View File

@@ -4022,9 +4022,9 @@ class execution extends control
public function all($status = 'undone', $orderBy = 'order_asc', $productID = 0, $param = '', $recTotal = 0, $recPerPage = 100, $pageID = 1)
{
$this->app->loadLang('my');
$this->app->loadLang('product');
$this->app->loadLang('stage');
$this->app->loadLang('programplan');
$this->loadModel('product');
$this->loadModel('datatable');
$from = $this->app->tab;
@@ -4044,25 +4044,22 @@ class execution extends control
$actionURL = $this->createLink('execution', 'all', "status=bySearch&orderBy=$orderBy&productID=$productID&param=myQueryID");
$this->execution->buildSearchForm($queryID, $actionURL);
$this->view->title = $this->lang->execution->allExecutions;
$this->view->position[] = $this->lang->execution->allExecutions;
$executionStats = $this->execution->getStatData(0, $status, $productID, 0, false, $queryID, $orderBy, $pager);
$allExecutionsNum = $this->execution->getStatData(0, 'all');
$this->view->allExecutionsNum = count($allExecutionsNum);
$this->view->executionStats = $executionStats;
$this->view->productList = $this->loadModel('product')->getProductPairsByProject(0);
$this->view->productID = $productID;
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->projects = array('') + $this->project->getPairsByProgram();
$this->view->status = $status;
$this->view->from = $from;
$this->view->param = $param;
$this->view->showBatchEdit = $this->cookie->showExecutionBatchEdit;
$this->view->title = $this->lang->execution->allExecutions;
$this->view->position[] = $this->lang->execution->allExecutions;
$this->view->executionStats = $executionStats;
$this->view->allExecutionsNum = $this->execution->getStatData(0, 'all', 0, 0, false, '', 'id_asc', null, true);
$this->view->productList = $this->product->getProductPairsByProject(0);
$this->view->productID = $productID;
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->users = $this->loadModel('user')->getPairs('noletter', '', 0, array_unique(array_column($executionStats, 'PM')));
$this->view->projects = array('') + $this->project->getPairsByProgram();
$this->view->status = $status;
$this->view->from = $from;
$this->view->param = $param;
$this->view->showBatchEdit = $this->cookie->showExecutionBatchEdit;
$this->display();
}
@@ -4073,14 +4070,14 @@ class execution extends control
* @param int $executionID
* @param string $module
* @param string $objectType
* @param string $orderby
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function whitelist($executionID = 0, $module='execution', $objectType = 'sprint', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function whitelist($executionID = 0, $module = 'execution', $objectType = 'sprint', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* use first execution if executionID does not exist. */
if(!isset($this->executions[$executionID])) $executionID = key($this->executions);

View File

@@ -1871,7 +1871,7 @@ class executionModel extends model
* @access public
* @return array
*/
public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null)
public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null, $isCount = false)
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getExecutionStats($browseType);
@@ -1921,6 +1921,8 @@ class executionModel extends model
->page($pager, 't1.id')
->fetchAll('id');
if($isCount) return count($executions);
if(empty($productID) and !empty($executions)) $projectProductIdList = $this->dao->select('project, GROUP_CONCAT(product) as product')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($executions))->groupBy('project')->fetchPairs();
$hours = $this->loadModel('project')->computerProgress($executions);
@@ -5724,13 +5726,13 @@ class executionModel extends model
* @param array $users
* @param int $productID
* @access public
* @return void
* @return array
*/
public function generateRow($executions, $users, $productID)
{
$today = helper::today();
$rows = array();
foreach($executions as $id => $execution)
foreach($executions as $execution)
{
$label = $execution->type == 'stage' ? 'label-warning' : 'label-info';
$link = $execution->type == 'kanban' ? helper::createLink('execution', 'kanban', "id=$execution->id") : helper::createLink('execution', 'task', "id=$execution->id");

View File

@@ -37,7 +37,7 @@ js::set('isCNLang', !$this->loadModel('common')->checkNotCN());
<div class='btn-toolBar pull-left'>
<?php if($from == 'project'):?>
<div class='btn-group'>
<?php $viewName = $productID != 0 ? zget($productList,$productID) : $lang->product->allProduct;?>
<?php $viewName = $productID != 0 ? zget($productList, $productID) : $lang->product->allProduct;?>
<a href='javascript:;' class='btn btn-link btn-limit' data-toggle='dropdown'><span class='text' title='<?php echo $viewName;?>'><?php echo $viewName;?></span> <span class='caret'></span></a>
<ul class='dropdown-menu' style='max-height:240px; max-width: 300px; overflow-y:auto'>
<?php