From f7da11bc69dd4a3713d995c3f496d4adba3e736d Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 19 Aug 2024 17:03:33 +0100 Subject: [PATCH] Updated the way groups work there --- src/dashboards/MasterCorporate.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dashboards/MasterCorporate.tsx b/src/dashboards/MasterCorporate.tsx index 0d8c4996..2f661040 100644 --- a/src/dashboards/MasterCorporate.tsx +++ b/src/dashboards/MasterCorporate.tsx @@ -53,7 +53,7 @@ interface Props { user: MasterCorporateUser; } -type StudentPerformanceItem = User & {corporate?: CorporateUser; group: string}; +type StudentPerformanceItem = User & {corporate?: CorporateUser; group?: Group}; const StudentPerformanceList = ({items, stats, users, groups}: {items: StudentPerformanceItem[]; stats: Stat[]; users: User[]; groups: Group[]}) => { const [isShowingAmount, setIsShowingAmount] = useState(false); const [availableCorporates] = useState( @@ -82,7 +82,7 @@ const StudentPerformanceList = ({items, stats, users, groups}: {items: StudentPe }), columnHelper.accessor("group", { header: "Group", - cell: (info) => info.getValue(), + cell: (info) => info.getValue()?.name || "N/A", }), columnHelper.accessor("corporate", { header: "Corporate", @@ -372,7 +372,7 @@ export default function MasterCorporateDashboard({user}: Props) { .filter((x) => x.type === "student" && groups.flatMap((g) => g.participants).includes(x.id)) .map((u) => ({ ...u, - group: groups.find((x) => x.participants.includes(u.id))?.name || "N/A", + group: groups.find((x) => x.participants.includes(u.id)), corporate: getCorporateUser(u, users, groups), }));