From 32697c6d13fcd46eb755f83b9ce2e9e972a655ab Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 30 Jul 2023 00:58:15 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=A4=A6=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20inflated=20ticket=20count=20and=20negative=20response=20time?= =?UTF-8?q?s=20in=20stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 8416d0f..83a462c 100644 --- a/src/lib/stats.js +++ b/src/lib/stats.js @@ -38,7 +38,7 @@ module.exports.sendToHouston = async client => { } return true; }).map(guild => { - const closedTickets = guild.tickets.filter(t => t.closedAt); + const closedTickets = guild.tickets.filter(t => t.firstResponseAt && t.closedAt); return { avg_resolution_time: msToMins(closedTickets.reduce((total, ticket) => total + (ticket.closedAt - ticket.createdAt), 0) ?? 1 / closedTickets.length), avg_response_time: msToMins(closedTickets.reduce((total, ticket) => total + (ticket.firstResponseAt - ticket.createdAt), 0) ?? 1 / closedTickets.length), @@ -58,7 +58,7 @@ module.exports.sendToHouston = async client => { locale: guild.locale, members: client.guilds.cache.get(guild.id).memberCount, messages: users.reduce((total, user) => total + user.messageCount, 0), // global not guild, don't count archivedMessage table rows, they can be deleted - tickets: guilds.reduce((total, guild) => total + guild.tickets.length, 0), + tickets: guild.tickets.length, }; }), id: md5(client.user.id),