* Adjust for get leaf nodes.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user