* 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,20 +4044,17 @@ 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->title = $this->lang->execution->allExecutions;
$this->view->position[] = $this->lang->execution->allExecutions;
$this->view->executionStats = $executionStats;
$this->view->productList = $this->loadModel('product')->getProductPairsByProject(0);
$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');
$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;
@@ -4073,7 +4070,7 @@ 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

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");