Skip to content

Commit

Permalink
fix: 🤦‍♂️ inflated ticket count and negative response times in stats
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Jul 29, 2023
1 parent f164fad commit 32697c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/stats.js
Expand Up @@ -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),
Expand All @@ -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),
Expand Down

0 comments on commit 32697c6

Please sign in to comment.