Question

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

Was it helpful?

Solution

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'
}]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top