* Change api for story.

This commit is contained in:
zhengrunyu
2022-03-30 09:35:52 +08:00
committed by hufangzhou
parent 97ddf11ecd
commit a6612ff750
2 changed files with 23 additions and 4 deletions
+22 -3
View File
@@ -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');
+1 -1
View File
@@ -1122,7 +1122,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');