0

When I ran into issues with a query to the lbapi, I took a step back a created a very basic app with just the query in it that logged the results.

It looked something like this:

Deft.Chain.pipeline([
    function() {
        var dd = Ext.create('Deft.Deferred');
        Ext.create('Rally.data.lookback.SnapshotStore', {
            fetch    : ['Parent', 'Feature'],
            filters  : [{
                property : '__At',
                value    : 'current'
            },{
                property : '_TypeHierarchy',
                value    : 'HierarchicalRequirement'
            }]
        }).load({
            params : {
                compress : true,
                removeUnauthorizedSnapshots : true
            },
            callback : function(store) {
                console.log('store',store);                     
                dd.resolve(store);
            }
        });
        return dd.promise;
    }
]).then({
    success: function(records) {
        console.log('records', records);
    }
});

Strangely, if I added a filter like this:

{
      property : 'Parent',
      operator : '!=',
      value    : null
}

I got more results. I concluded that the removeUnauthorizedSnapshots must filter the results after they have all been gathered into a page of 20000 results, and thus this would be possible. Can anyone confirm this? Hopefully such confusion can be avoided in the future

Trever Shick
  • 1,734
  • 16
  • 17
Tore
  • 1,236
  • 2
  • 11
  • 21

1 Answers1

0

You are correct.

removeUnauthorizedSnapshots filters the current pagesize set of results, which means it might actually return a page with 0 results in an extreme case when all results are or were once associated with projects that the user is not allowed to access.

I am not sure about the outcome when you got more results. Additional filter should only limit the number of results further, and I see further reduction when I use a similar code.

But I would like to suggest a syntax change for the filter on Parent property. Nulls are not storied in Lookback API at all, so any != null or == null queries are a little misleading. In your code it works, but in the case of Parent == null, it will return snapshots that don't have a Parent attribute, not just those that have a Parent attribute that is null. You may use exists true instead of != null

filters  : [
     {
           property : 'Parent',
           operator : 'exists',
           value : true

    },{
           property : '__At',
           value    : 'current'
     },{
           property : '_TypeHierarchy',
           value    : 'HierarchicalRequirement'
}]
nickm
  • 5,936
  • 1
  • 13
  • 14
  • I expected to see a reduction as well, but you are saying the filters provided are applied before the unauthorized snapshots are removed, so my theory was not quite correct? – Tore Sep 11 '13 at 15:46
  • I believe unauthorized snapshots are removed after filters are applied. I added to my answer above an alternaive syntax to the filter on Parent property. – nickm Sep 12 '13 at 16:38