Skip to content

Commit 0026553

Browse files
authored
Merge pull request #767 from melihkorkmaz/user-loyalty-perncetace-as-NaN
Fixed NaN for loyalty table.
2 parents 328658b + c631f62 commit 0026553

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

frontend/express/public/javascripts/countly/countly.views.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,15 @@ window.LoyaltyView = countlyView.extend({
268268
for (var iTick = 1; iTick < ticks.length - 1; iTick++) {
269269
var all = dp[0].data[iTick][1] ? countlyCommon.formatNumber(dp[0].data[iTick][1]) : 0;
270270
var allPercentage = countlyCommon.formatNumber((100 * all) / totals[0], 2);
271+
allPercentage = isNaN(allPercentage) ? 0 : allPercentage;
271272

272-
var tDays = dp[1].data[iTick][1] ? countlyCommon.formatNumber(dp[1].data[iTick][1]) : 0;
273+
var tDays = (dp[1].data[iTick] && dp[1].data[iTick][1]) ? countlyCommon.formatNumber(dp[1].data[iTick][1]) : 0;
273274
var tDaysPercentage = countlyCommon.formatNumber((100 * tDays) / totals[1], 2);
275+
tDaysPercentage = isNaN(tDaysPercentage) ? 0 : tDaysPercentage;
274276

275-
var sDays = dp[2].data[iTick][1] ? countlyCommon.formatNumber(dp[2].data[iTick][1]) : 0;
277+
var sDays = (dp[2].data[iTick] && dp[2].data[iTick][1]) ? countlyCommon.formatNumber(dp[2].data[iTick][1]) : 0;
276278
var sDaysPercentage = countlyCommon.formatNumber((100 * sDays) / totals[2], 2);
279+
sDaysPercentage = isNaN(sDaysPercentage) ? 0 : sDaysPercentage;
277280

278281
chartData.push({
279282
l: ticks[iTick][1],
@@ -5710,4 +5713,4 @@ $.ajaxPrefilter(function(options, originalOptions, jqXHR) {
57105713
}
57115714

57125715
}
5713-
});
5716+
});

0 commit comments

Comments
 (0)