问题
How do I determine how long something spent in a state? Here is a query I have for pulling specifics on a user story, but I'm trying to understand how to get the duration something spent in In Progress before going to completed. To be more specific, customizing Cycle Time
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/xxxx/artifact/snapshot/query.js?find={"FormattedID":"US41","_PreviousValues.ScheduleState":"In-Progress"}&fields=["ScheduleState","_ValidFrom","_ValidTo","_PreviousValues"]&hydrate=["ScheduleState","_ValidFrom","_ValidTo","_PreviousValues"]&sort={_ValidFrom: -1}&pagesize=1
I don't see where the ValidFrom and ValidTo provides that information.
回答1:
This solution seems to be working for me. Hope it helps!
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Ext.create('Rally.data.lookback.SnapshotStore', {
fetch : ['ScheduleState'],
hydrate : ['ScheduleState'],
filters : [{
property : '_UnformattedID',
value : 41
}],
sorters : [{
property : '_ValidTo',
direction : 'ASC'
}]
}).load({
params : {
compress : true,
removeUnauthorizedSnapshots : true
},
callback : function(records, operation, success) {
var cycleTime = Rally.util.DateTime.getDifference(new Date(Rally.util.Array.last(Ext.Array.filter(records, function(record) {
return record.get('ScheduleState') === 'Accepted';
})).get('_ValidFrom')), new Date(Rally.util.Array.last(Ext.Array.filter(records, function(record) {
return record.get('ScheduleState') === 'In-Progress';
})).get('_ValidFrom')), 'day'));
}
});
}
});
来源:https://stackoverflow.com/questions/18971688/custom-cycle-time