1

我正在尝试从我在 Rally 中的默认项目下获取所有叶子故事,并将每个故事的迭代值(如果存在)复制到自定义字段。这是我的代码。

_update_dIteration_for_all_leaves: function(){
    console.log("Working on dIteration for all leaves");

    var me = this;
    var query = Ext.create('Rally.data.lookback.QueryFilter',{property: '_TypeHierarchy', operator: '=', value: "HierarchicalRequirement"});
    query.and(Ext.create('Rally.data.lookback.QueryFilter',{property: 'Children', operator: '=', value: null}));
    query.and(Ext.create('Rally.data.lookback.QueryFilter',{property: '__At', operator: '=', value: 'current'}));
    Ext.create('Rally.data.lookback.SnapshotStore',{
        autoLoad: true,
        context: this.getContext(), 

       // tried context:{workspace: this.getContext().getWorkspace(), project: this.getContext().getProject()} but doesn't work.

        fetch:['Name','FormattedID','Iteration','ObjectID'],
        filters: query,
        listeners: {
            load: function(store,data,success){
                console.log("How many leaf stories? ",data.length);
                var configs = [];
                for(var i=0;i<data.length;i++){
                    if(data[i].data.Iteration!=null && data[i].data.Iteration!=""){
                        console.log('data iteration ', data[i].data.Iteration);
                        configs.push({
                            model: "Iteration",
                            fetch: ['Name','ObjectID'],
                            filters: [{property: 'ObjectID', operator: '=', value: data[i].data.Iteration}],
                            storyid: data[i].data.ObjectID
                        });
                    }
                }
                console.log('configs length ',configs);
                    async.map(configs, me.wsapiQuery, function(err,results){
                //      console.log('len ',results);
                        for(var i=0;i<results.length;i++){
                            //var ObjectID = results[i].get('ObjectID');
                            var name = results[i].get('Name');
                            console.log("Name of iteration "+name+" ID of story "+configs[i].storyid);

                        }

                    });
            }
        },
        scope: this
    });
}

我无法为此查询添加上下文,也无法仅从我所在的当前项目中获取叶故事。还尝试将 Query fiter 添加为:

 {property: '_ProjectHierarchy',operator: 'in', value: this.getContext().getProject().ObjectID}

虽然我不确定 _ProjectHierarchy 是否是正确的方法,但它仍然不起作用。

4

1 回答 1

1

使用 _ProjectHierarchy 不会将查询范围限定为单个项目,但会将其范围限定为一个项目及其子项目。直接在浏览器中尝试 Lookback API 查询以查看差异。例如,在我的环境中,使用的第一个查询"_ProjectHierarchy":{"$in":[14020168984]}返回 TotalResultCount:229,但使用的第二个查询"Project":14020168984返回 TotalResultCount:128

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/14020168894/artifact/snapshot/query.js?find={"_TypeHierarchy":"HierarchicalRequirement","_ProjectHierarchy":{"$in":[14020168984]}}

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/14020168894/artifact/snapshot/query.js?find={"_TypeHierarchy":"HierarchicalRequirement","Project":14020168984}

您可以附加&fetch=["Project"]到这些查询以查看第二个查询仅返回来自一个项目的故事。

于 2014-02-27T23:03:26.223 回答