我正在尝试从我在 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 是否是正确的方法,但它仍然不起作用。