Updated the way groups work there

This commit is contained in:
Tiago Ribeiro
2024-08-19 17:03:33 +01:00
parent 10802f6bb5
commit f7da11bc69

View File

@@ -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),
}));