* Performance for project and execution.

This commit is contained in:
zhujinyong
2023-06-12 09:39:26 +08:00
parent 1a1b3bbb07
commit aeb17903d2
6 changed files with 9 additions and 35 deletions
+2
View File
@@ -4040,6 +4040,8 @@ class execution extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->loadModel('program')->refreshStats(); // Refresh stats fields of projects.
$queryID = ($status == 'bySearch') ? (int)$param : 0;
$actionURL = $this->createLink('execution', 'all', "status=bySearch&orderBy=$orderBy&productID=$productID&param=myQueryID");
$this->execution->buildSearchForm($queryID, $actionURL);
-18
View File
@@ -1952,18 +1952,8 @@ class executionModel extends model
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);
$burns = $this->getBurnData($executions);
/* Get the number of execution teams. */
$teams = $this->dao->select('t1.root,count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->where('t1.root')->in(array_keys($executions))
->andWhere('t1.type')->ne('project')
->andWhere('t2.deleted')->eq(0)
->groupBy('t1.root')
->fetchAll('root');
$productNameList = $this->dao->select('t1.id,GROUP_CONCAT(t3.`name`) as productName')->from(TABLE_EXECUTION)->alias('t1')
->leftjoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
->leftjoin(TABLE_PRODUCT)->alias('t3')->on('t2.product=t3.id')
@@ -2001,10 +1991,6 @@ class executionModel extends model
$burnData = isset($burns[$execution->id]) ? $burns[$execution->id] : array();
foreach($burnData as $data) $execution->burns[] = $data->value;
/* Process the hours. */
$execution->hours = isset($hours[$execution->id]) ? $hours[$execution->id] : (object)$emptyHour;
$execution->teamCount = isset($teams[$execution->id]) ? $teams[$execution->id]->teams : 0;
if(isset($executionTasks) and isset($executionTasks[$execution->id]))
{
$tasks = array_chunk($executionTasks[$execution->id], $this->config->task->defaultLoadCount, true);
@@ -5769,10 +5755,6 @@ class executionModel extends model
$execution->asParent = !empty($execution->children);
$execution->status = zget($this->lang->execution->statusList, $execution->status);
$execution->PM = zget($users, $execution->PM);
$execution->progress = $execution->hours->progress;
$execution->estimate = $execution->hours->totalEstimate;
$execution->consumed = $execution->hours->totalConsumed;
$execution->left = $execution->hours->totalLeft;
$children = isset($execution->children) ? $execution->children : array();
unset($execution->children);
+2 -1
View File
@@ -51,6 +51,8 @@ class program extends control
$programType = $this->cookie->programType ? $this->cookie->programType : 'bylist';
$this->program->refreshStats(); // Refresh stats fields of projects.
if($programType === 'bygrid')
{
$programs = $this->program->getProgramStats($status, 20, $orderBy);
@@ -107,7 +109,6 @@ class program extends control
$this->view->pager = $pager;
$this->view->programType = $programType;
$this->view->PMList = $PMList;
$this->view->progressList = $this->program->getProgressList(array_keys($programs));
$this->view->hasProject = $hasProject;
$this->display();
-11
View File
@@ -1448,21 +1448,11 @@ class programModel extends model
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectStats($browseType);
$this->refreshStats(); // Refresh stats fields of projects.
$projects = $this->getProjectList($programID, $browseType, $queryID, $orderBy, $pager, $programTitle, $involved, $queryAll);
if(empty($projects)) return array();
$leftTasks = ($this->cookie->projectType and $this->cookie->projectType == 'bycard') ? $this->loadModel('project')->getProjectLeftTasks(array_keys($projects)) : array();
/* Get the members of project teams. */
$teamMembers = $this->dao->select('t1.root,t1.account')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->where('t1.root')->in(array_keys($projects))
->andWhere('t1.type')->eq('project')
->andWhere('t2.deleted')->eq(0)
->fetchGroup('root', 'account');
/* Process projects. */
foreach($projects as $projectID => $project)
{
@@ -1475,7 +1465,6 @@ class programModel extends model
if($delay > 0) $project->delay = $delay;
}
$project->teamMembers = isset($teamMembers[$projectID]) ? array_keys($teamMembers[$projectID]) : array();
$project->leftTasks = isset($leftTasks[$projectID]) ? $leftTasks[$projectID]->tasks : '—';
/* Convert predefined HTML entities to characters. */
+2 -4
View File
@@ -86,11 +86,9 @@
<td><?php echo $program->begin;?></td>
<td><?php echo $program->end == LONG_TIME ? $lang->program->longTime : $program->end;?></td>
<td>
<?php if(isset($progressList[$program->id])):?>
<div class='progress-pie' data-doughnut-size='85' data-color='#00DA88' data-value='<?php echo round($progressList[$program->id])?>' data-width='26' data-height='26' data-back-color='#e8edf3'>
<div class='progress-info'><?php echo round($progressList[$program->id]);?></div>
<div class='progress-pie' data-doughnut-size='85' data-color='#00DA88' data-value='<?php echo round($program->progress)?>' data-width='26' data-height='26' data-back-color='#e8edf3'>
<div class='progress-info'><?php echo round($program->progress);?></div>
</div>
<?php endif;?>
</td>
<?php foreach($extendFields as $extendField) echo "<td>" . $this->loadModel('flow')->getFieldValue($extendField, $program) . "</td>";?>
<td class='c-actions'>
+3 -1
View File
@@ -405,8 +405,10 @@ class project extends control
$actionURL = $this->createLink('project', 'browse', "&programID=$programID&browseType=bySearch&queryID=myQueryID");
$this->project->buildSearchForm($queryID, $actionURL);
$this->loadModel('program')->refreshStats(); // Refresh stats fields of projects.
$programTitle = $this->loadModel('setting')->getItem('owner=' . $this->app->user->account . '&module=project&key=programTitle');
$projectStats = $this->loadModel('program')->getProjectStats($programID, $browseType, $queryID, $orderBy, $pager, $programTitle);
$projectStats = $this->program->getProjectStats($programID, $browseType, $queryID, $orderBy, $pager, $programTitle);
$this->view->title = $this->lang->project->browse;
$this->view->projectStats = $projectStats;