* Adjust for get leaf nodes.

This commit is contained in:
wangyidong
2024-07-06 15:01:55 +08:00
committed by 孙广明
parent e98509e670
commit 8626117a22
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -3952,7 +3952,7 @@ class storyModel extends model
$allStories = $this->dao->select('id,parent,color,isParent,root,path,grade,product,pri,type,status,stage,title,estimate')->from(TABLE_STORY)->where('root')->in($rootIdList)->andWhere('deleted')->eq(0)->orderBy($orderBy)->fetchAll('id');
if($browseType == 'bysearch')list($allStories, $stories) = $this->storyTao->getSearchedStoriesForTrack($allStories, $stories);
$leafNodes = $this->storyTao->getLeafNodes($stories);
$leafNodes = $this->storyTao->getLeafNodes($stories, $storyType);
$tracks = array();
$lanes = $this->storyTao->buildTrackLanes($leafNodes, $storyType);
+5 -1
View File
@@ -2218,14 +2218,18 @@ class storyTao extends storyModel
* Get leaf node by all stories, and sort by base nodes.
*
* @param array $stories
* @param string $storyType epic|requirement|story
* @access public
* @return array
*/
public function getLeafNodes(array $stories): array
public function getLeafNodes(array $stories, string $storyType = 'epic'): array
{
$leafNodes = array();
foreach($stories as $story)
{
if($storyType == 'requirement' && $story->type == 'epic') continue;
if($storyType == 'story' && ($story->type == 'epic' || $story->type == 'requirement')) continue;
if(empty($story->isParent)) $leafNodes[$story->id] = $story;
}