Rally无法加载数据SnapshotStore

时间:2014-02-18 17:24:12

标签: rally lookbackapi

这是我的代码:

_update_feature: function(fID){
     var query = Ext.create('Rally.data.lookback.QueryFilter',{
        property: '_ItemHierarchy', operator: 'in', value: fID
    }).and( Ext.create('Rally.data.lookback.QueryFilter',{
        property: '_TypeHierarchy', operator: '=', value: "HierarchicalRequirement"
    })).and(Ext.create('Rally.data.lookback.QueryFilter',{
        property: 'Children', operator: '=', value: null
    }));
    query = query.and(Ext.create('Rally.data.lookback.QueryFilter',{property: '__At', operator: '=',value: 'current' }));
    var me = this;
    Ext.create('Rally.data.lookback.SnapshotStore',{
        autoLoad: true,
        fetch: ['Iteration','Name','ObjectID'],
        filters: query,
        sorters:[{property: 'Iteration', direction: 'DESC'}],
        listeners:{
            load: function(store,data,success){
                console.log("data ",data,' success ',success); //returns empty array but success returns true
                var iter_array = [];
                var unscheduled = false;
                var that = this;

                for(var i=0;i<data.length;i++){
                    if(data[i].data.Iteration.length!=0)
                    iter_array[i] = parseInt(data[i].data.Iteration);
                }


                if(data.length!=iter_array.length)
                    unscheduled = true;

                var groupedByEndDate = _.uniq(me.store_iterations);

                var latest_iteration = _.first(_.intersection(groupedByEndDate,iter_array));
                var first_iteration = _.last(_.intersection(groupedByEndDate,iter_array));
                console.log('FI ',first_iteration,' LI ',latest_iteration);
                //use async.js here
                var configs = [];
                configs.push({
                    model: "Iteration",
                    fetch: ['Name','StartDate','EndDate','ObjectID'],
                    filters: [{property: 'ObjectID', operator: '=' , value: first_iteration}]
                });
                configs.push({
                    model: "Iteration",
                    fetch: ['Name','StartDate','EndDate','ObjectID'],
                    filters: [{property: 'ObjectID', operator: '=' , value: latest_iteration}]
                });
                console.log('Configs before  ',configs);
                async.map(configs, this.wsapiQuery, function(err,results){
                console.log('Configs After ',configs);
                var firstIteration = results[0];
                var lastIteration = results[1];

                console.log('FID: ',fID,' First Data ',firstIteration[0].get("StartDate"),' Second Data ',lastIteration[0].get("EndDate"));
                var startDate = firstIteration[0].get("StartDate");
                var EndDate = lastIteration[0].get("EndDate");
                var dIteration = lastIteration[0].get("Name");
                me._set_feature_level_values(fID,dIteration,unscheduled,startDate,EndDate);


            });

            }, scope: this
        }

    });

}, 
wsapiQuery: function (config,callback){
    Ext.create('Rally.data.WsapiDataStore',{
        autoLoad: true,
        model: config.model,
        fetch: config.fetch,
        filters: config.filters,
        listeners: {
            scope: this,
            load: function(store,data){
                callback(null,data);
            }
        }
    });
}

我无法加载数据,返回的数据为空但成功为真。我的SnapshotStore代码有什么问题吗?我期待它的一些数据。我试图获取具有给定特征对象id的特征的所有子叶节点故事。

1 个答案:

答案 0 :(得分:2)

您可以尝试更改此行:

query = query.and(Ext.create('Rally.data.lookback.QueryFilter',{property: '__At', operator: '=',value: 'current' }));

到此:

query = query.and(Ext.create('Rally.data.lookback.QueryFilter',{property: '__At', value: 'current' }));

__ At被翻译成ValidFrom和ValidTo:

{ ObjectID: 777, _ValidFrom: {$lte: "current"}, _ValidTo:{$gt: "current"}}

文档中的示例(https://rally1.rallydev.com/analytics/doc)不使用__At的运算符。如果这不起作用,请检查您的网络选项卡并发布作为HTTP请求传递的内容。