From 5b4f69ec9eead5745e8e338e56d5f4b427c9c55d Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 25 May 2023 16:23:25 +0100 Subject: [PATCH] fix: `NaN` stats --- src/lib/stats.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/stats.js b/src/lib/stats.js index 3aa9e7c..19ef47e 100644 --- a/src/lib/stats.js +++ b/src/lib/stats.js @@ -1,2 +1,2 @@ -module.exports.getAvgResolutionTime = tickets => (tickets.reduce((total, ticket) => total + (ticket.closedAt - ticket.createdAt), 0) ?? 1) / tickets.length; -module.exports.getAvgResponseTime = tickets => (tickets.reduce((total, ticket) => total + (ticket.firstResponseAt - ticket.createdAt), 0) ?? 1) / tickets.length; +module.exports.getAvgResolutionTime = tickets => (tickets.reduce((total, ticket) => total + (ticket.closedAt - ticket.createdAt), 0) || 1) / tickets.length; +module.exports.getAvgResponseTime = tickets => (tickets.reduce((total, ticket) => total + (ticket.firstResponseAt - ticket.createdAt), 0) || 1) / tickets.length;