From c7f13939b8f081d67d7c80a9f5096b91dc4f4dcc Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Fri, 25 Mar 2022 10:38:38 +0800 Subject: [PATCH 1/2] * Change api for story. --- api/v1/entries/story.php | 25 ++++++++++++++++++++++--- module/story/control.php | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index 10580c0f8a..a3ee64e3db 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -53,22 +53,41 @@ class storyEntry extends Entry } $story->moduleTitle = $moduleTitle; + $users = $this->loadModel('user')->getList(); + + $simplifyUsers = array(); + foreach($users as $user) + { + $simplifyUser = new stdclass(); + $simplifyUser->id = $user->id; + $simplifyUser->account = $user->account; + $simplifyUser->realname = $user->realname; + $simplifyUser->avatar = $user->avatar; + $simplifyUsers[$user->account] = $simplifyUser; + } + $storyTasks = array(); foreach($story->tasks as $executionTasks) { foreach($executionTasks as $task) { if(!isset($data->data->executions->{$task->execution})) continue; - $storyTasks[] = $this->filterFields($task, 'id,name,type'); + $assignedTo = new stdClass(); + $assignedTo->account = $simplifyUsers[$task->assignedTo]->account; + $assignedTo->realname = $simplifyUsers[$task->assignedTo]->realname; + $assignedTo->avatar = $simplifyUsers[$task->assignedTo]->avatar; + + $task->assign = $assignedTo; + $storyTasks[] = $this->filterFields($task, 'id,name,type,status,assignedTo'); } } $story->tasks = $storyTasks; $story->bugs = array(); - foreach($data->data->bugs as $bug) $story->bugs[] = $this->filterFields($bug, 'id,title'); + foreach($data->data->bugs as $bug) $story->bugs[] = $this->filterFields($bug, 'id,title,status,pri,severity'); $story->cases = array(); - foreach($data->data->cases as $case) $story->cases[] = $this->filterFields($case, 'id,title'); + foreach($data->data->cases as $case) $story->cases[] = $this->filterFields($case, 'id,title,pri,status'); $story->requirements = array(); foreach($data->data->relations as $relation) $story->requirements[] = $this->filterFields($relation, 'id,title'); diff --git a/module/story/control.php b/module/story/control.php index d93e61e8f1..752b31c6f7 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1126,7 +1126,7 @@ class story extends control $story->files = $this->loadModel('file')->getByObject($story->type, $storyID); $product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id, type, status')->fetch(); $plan = $this->dao->findById($story->plan)->from(TABLE_PRODUCTPLAN)->fetch('title'); - $bugs = $this->dao->select('id,title')->from(TABLE_BUG)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll(); + $bugs = $this->dao->select('id,title,status,pri,severity')->from(TABLE_BUG)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll(); $fromBug = $this->dao->select('id,title')->from(TABLE_BUG)->where('toStory')->eq($storyID)->fetch(); $cases = $this->dao->select('id,title')->from(TABLE_CASE)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll(); $linkedMRs = $this->loadModel('mr')->getLinkedMRPairs($storyID, 'story'); From 646579d1f61471fb3c9ad4c34e7abe20f0cb9d18 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Mon, 28 Mar 2022 10:30:30 +0800 Subject: [PATCH 2/2] * Change api for story. --- api/v1/entries/story.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index a3ee64e3db..33d471c20c 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -55,30 +55,13 @@ class storyEntry extends Entry $users = $this->loadModel('user')->getList(); - $simplifyUsers = array(); - foreach($users as $user) - { - $simplifyUser = new stdclass(); - $simplifyUser->id = $user->id; - $simplifyUser->account = $user->account; - $simplifyUser->realname = $user->realname; - $simplifyUser->avatar = $user->avatar; - $simplifyUsers[$user->account] = $simplifyUser; - } - $storyTasks = array(); foreach($story->tasks as $executionTasks) { foreach($executionTasks as $task) { if(!isset($data->data->executions->{$task->execution})) continue; - $assignedTo = new stdClass(); - $assignedTo->account = $simplifyUsers[$task->assignedTo]->account; - $assignedTo->realname = $simplifyUsers[$task->assignedTo]->realname; - $assignedTo->avatar = $simplifyUsers[$task->assignedTo]->avatar; - - $task->assign = $assignedTo; - $storyTasks[] = $this->filterFields($task, 'id,name,type,status,assignedTo'); + $storyTasks[] = $this->filterFields($task, 'id,name,type,status'); } } $story->tasks = $storyTasks;