回溯API _ProjectHierarchy范围不广 [英] Lookback API _ProjectHierarchy not scoping down

查看:108
本文介绍了回溯API _ProjectHierarchy范围不广的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码来获取特定迭代的当前用户故事

问题是当我在查询中指定父项目时,我无法获得子项目的用户故事.例如,如果我具有这样的层次结构

Project 7890
     User Story 55
     User Story 56
        Project 6543
         User Story 57
           Project 3456
              User Story 777

理想情况下,如果我查询_ProjectHierarchy:7890,我应该得到用户故事55,用户故事56,用户故事57,用户故事777,因为该查询检索了其自身及其子项目的多个工作项,但是在这里我只能以获得用户故事55,用户故事66(是项目7890的用户故事),而不是用户故事57,用户故事777,因为它们是子项目的用户故事.我也想检索所选项目及其子项目的所有用户故事"(即,范围缩小).

解决方案

查看 LBAPI文档以获得一些很好的信息,尤其是_ProjectHierarchy和_ItemHierarchy/_TypeHierarchy之间的区别.

根据您的情况,您可能应该使用_ItemHierarchy/_TypeHierarchy:

工作项层次结构

工作项层次结构使用_ItemHierarchy字段遍历父级/子级关系.因此,如果您具有以下层次结构:

  Story 333
     Story 444
        Story 555
           Story 666
              Defect 777
                 Task 12
              Task 13
        Story 888
        Story 999

Story 666的文档如下所示:

  {
     ObjectID: 666,
     Parent: 555,
     _ItemHierarchy: [333, 444, 555, 666],
     ...
  }

要检索所有源自故事333的故事(包括333、444、555、666、888和999,但不包括Defect 777),则可以在查询中包括以下子句:

  {
     _ItemHierarchy: 333,
     _TypeHierarchy: HierarchicalRequirement
  }

项目层次结构

项目层次结构也表示为一个数组,该数组从此工作区的根项目开始.因此,如果工作项777在此项目层次结构的底部:

 Project 7890
    Project 6543
       Project 3456
          Work item 777

工作项777的文档如下所示:

 {
     ObjectID: 777,
     Project: 3456,
     _ProjectHierarchy: [7890, 6543, 3456],
     ...
 }

要检索Project 7890或其任何子项目中的多个工作项,只需在查询中包括以下子句:

_ProjectHierarchy: 7890

Hi I am fetching the current userstories for a particular iteration using the following code

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch:function(){
        me = this;
        combo = window.parent.Ext4.ComponentQuery.query('rallyiterationcombobox')[0];
        var iterationObjectID = combo.getRecord().data.ObjectID;
        var query1= { _ProjectHierarchy: me.getContext().getProject().ObjectID, Iteration : iterationObjectID , _TypeHierarchy:"HierarchicalRequirement"};
        var fields = ["ObjectID","FormattedID","Name","Parent","Release","Tags","PlanEstimate","ScheduleState","_ValidFrom","_ValidTo"];
        var hydrate = ["Tags","ScheduleState"];
        var post = { find :query1, fields : fields, hydrate : hydrate, pagesize : 10000 };
        var wsid = this.context.getWorkspace().ObjectID;
        var url = "https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/"+ wsid +"/artifact/snapshot/query.js";
        console.log("snapshot url:",url);


            Ext.Ajax.request({
                method: 'POST',
                url: url,
                jsonData : post,
                success: function(res) {
                    res = JSON.parse(res.responseText);
                    console.log("The final results are",res);


                },

                failure: function(failure) {
                    console.log("snapshot query failed!",failure);
                }
            });

The problem is that I could not get the user stories of the child projects when I specify the parent project in the query. For example if I have the hierarchy like this

Project 7890
     User Story 55
     User Story 56
        Project 6543
         User Story 57
           Project 3456
              User Story 777

Ideally If I query _ProjectHierarchy: 7890 I should be getting User Story 55,User Story 56,User Story 57,User Story 777 since the query retrieves the multiple work items of itself and its child projects,but here I am only able to get User Story 55,User Story 66(which are userstories of project 7890) but not User Story 57,User Story 777 since those are the User Stories of the child projects. I want to retrieve all User Stories of selected project and its child projects also(i.e scope down).

解决方案

Check out the LBAPI Docs for some good info on this, particularly the difference between _ProjectHierarchy and _ItemHierarchy/_TypeHierarchy.

In your situation, you should probably be using the _ItemHierarchy/_TypeHierarchy:

Work item hierarchy

The work item hierarchy traverses a Parent/Child relationship using the _ItemHierarchy field. So if you have this hierarchy:

  Story 333
     Story 444
        Story 555
           Story 666
              Defect 777
                 Task 12
              Task 13
        Story 888
        Story 999

The document for Story 666 would look like this:

  {
     ObjectID: 666,
     Parent: 555,
     _ItemHierarchy: [333, 444, 555, 666],
     ...
  }

To retrieve all Stories that descend from Story 333 (includes 333, 444, 555, 666, 888, and 999 but not Defect 777), you would include this clause in your query:

  {
     _ItemHierarchy: 333,
     _TypeHierarchy: "HierarchicalRequirement"
  }

Project hierarchy

The Project hierarchy is also represented as an array starting at a root Project for this Workspace. So if work item 777 is at the bottom of this Project hierarchy:

 Project 7890
    Project 6543
       Project 3456
          Work item 777

The document for work item 777 would look like this:

 {
     ObjectID: 777,
     Project: 3456,
     _ProjectHierarchy: [7890, 6543, 3456],
     ...
 }

To retrieve multiple work items that are in Project 7890 or any of its child projects, you would simply include this clause in your query:

_ProjectHierarchy: 7890

这篇关于回溯API _ProjectHierarchy范围不广的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆