forked from RallyApps/app-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CumulativeFlowCalculator.js
43 lines (36 loc) · 1.39 KB
/
CumulativeFlowCalculator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(function () {
var Ext = window.Ext4 || window.Ext;
Ext.define("Rally.apps.charts.rpm.cfd.CumulativeFlowCalculator", {
extend: "Rally.data.lookback.calculator.TimeSeriesCalculator",
getDerivedFieldsOnInput: function () {
var chartAggregationType = this.config.chartAggregationType;
return _.map(this.config.scheduleStates, function(state) {
return {
"as": state,
"f": function (snapshot) {
if (chartAggregationType === 'storycount') {
if (snapshot.ScheduleState) {
return snapshot.ScheduleState === state ? 1 : 0;
}
return 0;
} else {
if (snapshot.PlanEstimate) {
return snapshot.ScheduleState === state ? snapshot.PlanEstimate : 0;
}
return 0;
}
}
};
}, this);
},
getMetrics: function () {
return _.map(this.config.scheduleStates, function(state) {
return {
"field": state,
"as": state,
"f": "sum"
};
});
}
});
}());