From fdb532f96bb971d67b7e66dfc9e18fda5778b009 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 Sep 2024 10:21:06 +0800 Subject: [PATCH] * [misc] Fix the bug of error in tutorial. --- module/story/model.php | 8 +++++++- module/tutorial/model.php | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index eef83baeb8..1abac583d7 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -128,7 +128,11 @@ class storyModel extends model { if(empty($storyIdList)) return array(); - if(common::isTutorialMode()) return $this->loadModel('tutorial')->getStories(); + if(common::isTutorialMode()) + { + $story = $this->loadModel('tutorial')->getStory(); + return array($story->id => $story); + } return $this->dao->select('t1.*, t2.spec, t2.verify, t3.name as productTitle, t3.deleted as productDeleted') ->from(TABLE_STORY)->alias('t1') @@ -2281,6 +2285,8 @@ class storyModel extends model */ public function getProductStoryPairs(int|array $productIdList = 0, string|int $branch = 'all', array|string|int $moduleIdList = '', string|array $status = 'all', string $order = 'id_desc', int $limit = 0, string $type = 'full', string $storyType = 'story', bool|string $hasParent = true): array { + if(common::isTutorialMode()) return $this->loadModel('tutorial')->getStoryPairs(); + if($hasParent === 'false') $hasParent = false; $stories = $this->dao->select('t1.id, t1.title, t1.module, t1.pri, t1.estimate, t2.name AS product') diff --git a/module/tutorial/model.php b/module/tutorial/model.php index 48bc521391..370779fe9d 100644 --- a/module/tutorial/model.php +++ b/module/tutorial/model.php @@ -313,6 +313,21 @@ class tutorialModel extends model return $executionStat; } + /** + * 获取新手模式研发需求键值对。 + * Get tutorial story pairs. + * + * @access public + * @return array + */ + public function getStoryPairs(): array + { + $stories = $this->getStories(); + $storyPairs = array(); + foreach($stories as $story) $storyPairs[$story->id] = $story->title; + return $storyPairs; + } + /** * 获取新手模式研发需求。 * Get tutorial story. @@ -687,7 +702,7 @@ class tutorialModel extends model public function getExecutionStoryPairs(): array { $stories = $this->getStories(); - $story = $stories[0]; + $story = $stories[2]; return array($story->id => $story->title); }