diff --git a/frontend/express/public/core/events/javascripts/countly.details.models.js b/frontend/express/public/core/events/javascripts/countly.details.models.js index 7ab10683e8b..6f193b854e3 100644 --- a/frontend/express/public/core/events/javascripts/countly.details.models.js +++ b/frontend/express/public/core/events/javascripts/countly.details.models.js @@ -11,7 +11,8 @@ for (var i = 0; i < chartData.length; i++) { graphData[0].push(chartData[i].c ? chartData[i].c : 0); graphData[1].push(chartData[i].s ? chartData[i].s : 0); - graphData[2].push(chartData[i].dur ? chartData[i].dur / (chartData[i].c || 1) : 0); + let avgDur = (chartData[i].dur || 0) / (chartData[i].c || 1); + graphData[2].push(avgDur < 0.1 ? 0 : avgDur); if (chartData[i].c) { count += chartData[i].c; } diff --git a/frontend/express/public/javascripts/countly/countly.common.js b/frontend/express/public/javascripts/countly/countly.common.js index c5611b8239a..544fbd29e0e 100644 --- a/frontend/express/public/javascripts/countly/countly.common.js +++ b/frontend/express/public/javascripts/countly/countly.common.js @@ -4526,7 +4526,7 @@ * @example trimTo = 2, "Xh Xm Xs" result will be trimmed to "Xh Xm" */ countlyCommon.formatSecond = function(second, trimTo = 5) { - var timeLeft = parseInt(second); + var timeLeft = parseFloat(second); var dict = [ {k: 'year', v: 31536000}, {k: 'day', v: 86400}, @@ -4537,7 +4537,17 @@ var result = {year: 0, day: 0, hour: 0, minute: 0, second: 0}; var resultStrings = []; for (var i = 0; i < dict.length && resultStrings.length < 3; i++) { - result[dict[i].k] = Math.floor(timeLeft / dict[i].v); + if (dict[i].k === "second") { + if (timeLeft < 0.1) { + result.second = 0; + } + else { + result.second = Math.round(timeLeft * 10) / 10; + } + } + else { + result[dict[i].k] = Math.floor(timeLeft / dict[i].v); + } timeLeft = timeLeft % dict[i].v; if (result[dict[i].k] > 0) { if (result[dict[i].k] === 1) {