1

I would like to filter my userStories by comparing the AcceptedDate and the Iteration.EndDate. Something like AcceptedDate > Iteration.EndDate. Is it possible?

I tried the following but as i supposed, it didn't work:

var storiesQuery = Ext.create('Rally.data.WsapiDataStore', {
    model: 'UserStory',
    fetch: ['Iteration', 'AcceptedDate'],
    filters: [  
        {
            property: 'Iteration.EndDate',
            operator: '<',
            value: 'AcceptedDate'
        },
        {
            property: 'ScheduleState',
            operator: '=',
            value: 'Accepted'
        }, 
        {
            property: 'DirectChildrenCount',
            operator: '=',
            value: '0'
        },
        {
            property: 'AcceptedDate',
            operator: '<',
            value: 'LastMonth'
        }
    ]
});

Thanks.

4

1 回答 1

1

不幸的是,这在过滤器中不起作用:

{
     property: 'Iteration.EndDate',
     operator: '<',
     value: 'AcceptedDate'
 }

相反,我使用了这个条件

 Ext.Array.each(data, function(record) {
                    iteration = record.get('Iteration'); 
                    endDate = (iteration && iteration.EndDate) || 'None';
                    acceptedDate = record.get('AcceptedDate');
                    if (Rally.util.DateTime.fromIsoString(endDate) < acceptedDate) {

这是构建迭代结束日期后接受的故事网格的完整应用程序:

<!DOCTYPE html>
<html>
<head>
    <title>AcceptedAfterEndDate</title>

    <script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>



    <script type="text/javascript">
        Rally.onReady(function () {
Ext.define('CustomApp', {
                extend: 'Rally.app.App',
                componentCls: 'app',

                launch: function() {
                    Ext.create('Rally.data.WsapiDataStore', {
                        model: 'UserStory',
                        fetch:['Name','Iteration','AcceptedDate','ScheduleState','EndDate'],
                        autoLoad: true,
                        listeners: {
                            load: this._onDataLoaded,
                            scope: this
                        }
                    });
                },

                _onDataLoaded: function(store, data) {
                    var records = [];
                    var iteration;
                    var endDate;
                    var acceptedDate;
                    Ext.Array.each(data, function(record) {
                        iteration = record.get('Iteration'); 
                        endDate = (iteration && iteration.EndDate) || 'None';
                        acceptedDate = record.get('AcceptedDate');
                        if (Rally.util.DateTime.fromIsoString(endDate) < acceptedDate) {
                                records.push({
                                   ScheduleState: record.get('ScheduleState'),
                                   Name: record.get('Name'),
                                   AcceptedDate: record.get('AcceptedDate'),
                                   Iteration: (iteration && iteration.Name) || 'None',
                                   EndDate: (iteration && iteration.EndDate) || 'None',
                                });
                        }

                    });

                    this.add({
                        xtype: 'rallygrid',
                        store: Ext.create('Rally.data.custom.Store', {
                            data: records,
                            filters:[
                                {property: 'ScheduleState',
                                operator: '=',
                                value: 'Accepted'}
                                ]

                        }),
                        columnCfgs: [
                            {
                                text: 'Name', dataIndex: 'Name'
                            },
                            {
                                text: 'Schedule State', dataIndex: 'ScheduleState'
                            },
                            {
                                text: 'Iteration', dataIndex: 'Iteration'
                            },
                            {
                                text: 'Iteration End Date', dataIndex: 'EndDate'
                            },
                             {
                                text: 'Accepted Date', dataIndex: 'AcceptedDate'
                            }
                        ]
                    });
                }
            });

            Rally.launchApp('CustomApp', {
                name:"AcceptedAfterEndDate",
                //parentRepos:""
            });

        });
    </script>




    <style type="text/css">
.app {
     /* Add app styles here */
}

    </style>

</head>
<body></body>
</html>
于 2013-07-23T21:17:09.040 回答