fix: dashboad ticket count conting only logged in user's tickets

This commit is contained in:
canove
2021-01-15 07:03:47 -03:00
parent d3a9b2a2f6
commit 454fd6ce08
2 changed files with 4 additions and 11 deletions

View File

@@ -41,17 +41,11 @@ const Chart = () => {
setChartData(prevState => {
let aux = [...prevState];
aux.map(a => {
aux.forEach(a => {
tickets.forEach(ticket => {
if (
format(startOfHour(parseISO(ticket.createdAt)), "HH:mm") === a.time
) {
return a.amount++;
} else {
return a;
}
format(startOfHour(parseISO(ticket.createdAt)), "HH:mm") === a.time &&
a.amount++;
});
return a;
});
return aux;