fix: open tickets count (#500)

Signed-off-by: Vin <28811713+VinDotRun@users.noreply.github.com>
This commit is contained in:
Vin 2023-11-15 21:35:32 -03:00 committed by GitHub
parent 539ed75ddf
commit b329d5ae2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,10 +65,11 @@ module.exports = class extends Listener {
firstResponseAt: true, firstResponseAt: true,
}, },
}); });
const closedTickets = tickets.filter(t => t.firstResponseAt && t.closedAt); const closedTicketsWithResponse = tickets.filter(t => t.firstResponseAt && t.closedAt);
const closedTickets = tickets.filter(t => t.closedAt);
cached = { cached = {
avgResolutionTime: ms(getAvgResolutionTime(closedTickets)), avgResolutionTime: ms(getAvgResolutionTime(closedTicketsWithResponse)),
avgResponseTime: ms(getAvgResponseTime(closedTickets)), avgResponseTime: ms(getAvgResponseTime(closedTicketsWithResponse)),
openTickets: tickets.length - closedTickets.length, openTickets: tickets.length - closedTickets.length,
totalTickets: tickets.length, totalTickets: tickets.length,
}; };