Reputation: 9389
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.
Upvotes: 1
Views: 422
Reputation: 5966
Unfortunately this will not work in the filter:
{
property: 'Iteration.EndDate',
operator: '<',
value: 'AcceptedDate'
}
Instead I used this condition
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) {
Here is the full app that builds a grid of stories accepted after iteration end date:
<!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>
Upvotes: 1