mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
fix: dashboad ticket count conting only logged in user's tickets
This commit is contained in:
@@ -109,7 +109,6 @@ const ListTicketsService = async ({
|
||||
|
||||
if (date) {
|
||||
whereCondition = {
|
||||
...whereCondition,
|
||||
createdAt: {
|
||||
[Op.between]: [+startOfDay(parseISO(date)), +endOfDay(parseISO(date))]
|
||||
}
|
||||
@@ -127,7 +126,7 @@ const ListTicketsService = async ({
|
||||
};
|
||||
}
|
||||
|
||||
const limit = 20;
|
||||
const limit = 40;
|
||||
const offset = limit * (+pageNumber - 1);
|
||||
|
||||
const { count, rows: tickets } = await Ticket.findAndCountAll({
|
||||
|
||||
12
frontend/src/pages/Dashboard/Chart.js
vendored
12
frontend/src/pages/Dashboard/Chart.js
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user