1

这是我的代码:

_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 的特征的所有子叶节点故事。

4

1 回答 1

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 请求传递的内容。

于 2014-02-19T02:27:36.237 回答