We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3edfdf2 + 24ac024 commit d2804a3Copy full SHA for d2804a3
plugins/slipping-away-users/api/api.js
@@ -46,13 +46,14 @@ const plugin = {},
46
BPromise.all(tasks).spread(function() {
47
const result = [];
48
periods.forEach((p,index) => {
49
- const percentage = (arguments[index] / arguments[periods.length]) * 100;
50
- result.push({
51
- period: p,
52
- count: arguments[index],
53
- percentage: `${ percentage.toFixed(2) }`,
54
- timeStamp: timeList[p],
55
- })
+ let percentage = (arguments[index] / arguments[periods.length]) * 100;
+ percentage = isNaN(percentage) ? 0 : percentage;
+ result.push({
+ period: p,
+ count: arguments[index],
+ percentage: `${ percentage.toFixed(2) }`,
+ timeStamp: timeList[p],
56
+ })
57
});
58
common.returnOutput(params, result);
59
0 commit comments