Rally Software

 View Only

How to include context to the iteration filter

  • 1.  How to include context to the iteration filter

    Posted Aug 20, 2020 02:42 PM
    Hi,

    In a custom app, am trying to add iteration filter to a get the list of iterations for a particular project. But it is showing iterations of the parent as well as child projects. When i console log "me.app.getContext().getDataContext()" it is showing only current project in which the app is installed.
    Below is the code

    Ext.create('Rally.data.wsapi.Store', {
                model: Ext.identityFn('Iteration'),
                autoLoad: true,
                context: me.app.getContext().getDataContext(),
                fetch: ["Name", "StartDate", "EndDate", "ObjectID", "State", "PlannedVelocity"],
                filters: [
                    {
                        property: "EndDate",
                        operator: ">",
                        value: new Date()
                    }
                ],
                sorters: [
                    {
                        property: 'StartDate',
                        direction: 'DESC'
                    }
                ],
                listeners: {
                    load: function(store, records, success) {
                        if (success) {
                            me._iterationStore = store;
                            if (setIteration) {
                                if (store.totalCount) {
                                    var curDate = new Date();
                                    for (i=0;i<store.totalCount;i++)
                                    {
     
                                        var startDate = new Date(store.getAt(i).get("StartDate"));
                                        var endDate = new Date(store.getAt(i).get("EndDate"));
                                        
    if (curDate > startDate && startDate < endDate)
                                        {
                                            me[iterConfigName].currentIteration = store.getAt(i).get('_ref');
                                            break;
                                        }
                                        
                                    }
                                }
                            }
     
                            deferred.resolve(me[iterConfigName].currentIteration);
                        }
                        else {
                            Rally.ui.notify.Notifier.showWarning({message: 'No appropriate Iterations available'});
                            deferred.reject();
                        }
                    }
                }
            });


    ------------------------------
    Thanks,
    Divya
    ------------------------------