* Adjust code for task #117451. Batch get data.

This commit is contained in:
王怡栋
2024-05-09 13:29:58 +08:00
parent 37d0e19462
commit 6201e68fa7
2 changed files with 9 additions and 16 deletions
+5 -12
View File
@@ -35,23 +35,16 @@ $cols['progress']['sortType'] = false;
$projectStats = initTableData($projectStats, $cols, $this->project);
$this->loadModel('story');
$waitCount = 0;
$doingCount = 0;
$suspendedCount = 0;
$closedCount = 0;
$projectIdList = array_column($projectStats, 'id');
$storyGroup = $this->loadModel('story')->fetchStoriesByProjectIdList($projectIdList);
$executionGroup = $this->loadModel('execution')->fetchExecutionsByProjectIdList($projectIdList);
foreach($projectStats as $project)
{
if($project->status == 'wait') $waitCount ++;
if($project->status == 'doing') $doingCount ++;
if($project->status == 'suspended') $suspendedCount ++;
if($project->status == 'closed') $closedCount ++;
$projectStories = $this->story->getExecutionStories($project->id);
$projectStories = zget($storyGroup, $project->id, array());
$project->storyCount = count($projectStories);
$project->storyPoints = round(array_sum(array_column($projectStories, 'estimate')), 2) . ' ' . $this->config->hourUnit;
$executions = $this->loadModel('execution')->getStatData($project->id, 'all');
$executions = zget($executionGroup, $project->id, array());
$project->executionCount = count($executions);
$project = $this->project->formatDataForList($project, $PMList);