1
我試圖從拉力賽中的默認項目下獲取所有葉子的故事,並將每個故事的迭代值(如果存在)複製到自定義字段。這是我的代碼。SnapshotStore中的拉力作用域
_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
});
}
我不能上下文添加到該查詢,而不是隻能從當前項目我在得到葉的故事也嘗試添加查詢作爲fiter:
{property: '_ProjectHierarchy',operator: 'in', value: this.getContext().getProject().ObjectID}
雖然我不確定_ProjectHierarchy是否是正確的方法,但它仍然無效。