From b9c097d42c4505267d3da5d58baf941f8ea8e342 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 9 Sep 2024 09:07:30 +0100 Subject: [PATCH] Had a bug in pagination --- .../MasterCorporate/MasterStatistical.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/dashboards/MasterCorporate/MasterStatistical.tsx b/src/dashboards/MasterCorporate/MasterStatistical.tsx index 8d3fb70b..bf7b0579 100644 --- a/src/dashboards/MasterCorporate/MasterStatistical.tsx +++ b/src/dashboards/MasterCorporate/MasterStatistical.tsx @@ -28,7 +28,7 @@ interface Props { } interface TableData { - user: string; + user: User | undefined; email: string; correct: number; corporate: string; @@ -62,7 +62,7 @@ const MasterStatistical = (props: Props) => { const [startDate, setStartDate] = React.useState(moment("01/01/2023").toDate()); const [endDate, setEndDate] = React.useState(moment().endOf("year").toDate()); - const {assignments} = useAssignmentsCorporates({ + const {assignments, isLoading} = useAssignmentsCorporates({ corporates: selectedCorporates, startDate, endDate, @@ -76,9 +76,11 @@ const MasterStatistical = (props: Props) => { const userResults = a.assignees.map((assignee) => { const userStats = a.results.find((r) => r.user === assignee)?.stats || []; const userData = users.find((u) => u.id === assignee); + if (!!userData) console.log(assignee, userData.name); + const corporate = getUserName(users.find((u) => u.id === a.assigner)); const commonData = { - user: userData?.name || "N/A", + user: userData, email: userData?.email || "N/A", userId: assignee, corporateId: a.corporateId, @@ -151,7 +153,7 @@ const MasterStatistical = (props: Props) => { header: "User", id: "user", cell: (info) => { - return {info.getValue()}; + return {info.getValue()?.name || "N/A"}; }, }), columnHelper.accessor("email", { @@ -281,6 +283,7 @@ const MasterStatistical = (props: Props) => { { @@ -302,6 +305,7 @@ const MasterStatistical = (props: Props) => { { {page * SIZE + 1} - {(page + 1) * SIZE > filteredRows.length ? filteredRows.length : (page + 1) * SIZE} /{" "} {filteredRows.length} -