From 8626117a229ca94f1c39880417200750f4773a6a Mon Sep 17 00:00:00 2001 From: wangyidong Date: Sat, 6 Jul 2024 14:59:23 +0800 Subject: [PATCH] * Adjust for get leaf nodes. --- module/story/model.php | 2 +- module/story/tao.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index f630cda55b..2b6daba38f 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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); diff --git a/module/story/tao.php b/module/story/tao.php index 95bd507703..529752d01f 100644 --- a/module/story/tao.php +++ b/module/story/tao.php @@ -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; }