1

This is my code:

_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);
            }
        }
    });
}

I am unable to load data, data returned is empty but success is true. Is there anything wrong with my SnapshotStore code? I am expecting some data from it. I am trying to get all child leaf node stories of a feature with a given feature object id.

Trever Shick
  • 1,734
  • 16
  • 17
Rohan Dalvi
  • 1,215
  • 1
  • 16
  • 38
  • 2
    I have successfully run your code in a custom app within Rally. I call this._update_feature with a feature id that doesn't exist and i get back 0 results exactly as you do. I then put in a valid feature id that i have permissions to and I get back all the snapshots. So your code appears to be appropriate but perhaps the fID being passed in is not correct or maybe you don't have permissions to the feature? Try calling _update_feature from your app launch() with a hard coded feature id that you can access through Rally and see if your results differ. – Trever Shick Feb 19 '14 at 03:31

1 Answers1

2

Can you try changing this line:

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

to this:

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

__At is translated into a ValidFrom and ValidTo:

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

The examples in the documentation (https://rally1.rallydev.com/analytics/doc) don't use an operator for __At. If that doesn't work, please check your network tab and post what is being passed as the HTTP request.

SRMelody
  • 153
  • 5