2014-02-27 1 views
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가 올바른 방법 일지 확실하지 않지만 여전히 작동하지 않습니다.

답변

1

_ProjectHierarchy를 사용하면 단일 프로젝트에 대한 쿼리 범위가 지정되지 않지만 프로젝트 및 해당 하위 프로젝트의 범위가 지정됩니다. Lookback API 쿼리를 브라우저에서 직접 사용해보십시오. 229 만 "Project":14020168984 수익률을 사용하는 두 번째 쿼리는 TotalResultCount : 예를 들어, 내 환경에서 "_ProjectHierarchy":{"$in":[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"]를 추가 할 수 두 번째 쿼리 만보고 한 프로젝트의 이야기를 반환합니다.