Solved a bug for the master statistical

This commit is contained in:
Tiago Ribeiro
2024-09-10 10:55:02 +01:00
parent 85c8f622ee
commit 33a46c227b
6 changed files with 13 additions and 13 deletions

View File

@@ -74,10 +74,8 @@ const MasterStatistical = (props: Props) => {
() =>
assignments.reduce((accmA: TableData[], a: AssignmentWithCorporateId) => {
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 userStats = !!userData ? a.results.find((r) => r.user === assignee)?.stats || [] : [];
const corporate = getUserName(users.find((u) => u.id === a.assigner));
const commonData = {
user: userData,
@@ -88,6 +86,7 @@ const MasterStatistical = (props: Props) => {
corporate,
assignment: a.name,
};
if (userStats.length === 0) {
return {
...commonData,
@@ -167,7 +166,7 @@ const MasterStatistical = (props: Props) => {
header: "Student ID",
id: "studentID",
cell: (info) => {
return <span>{(info.getValue() as StudentUser).studentID || "N/A"}</span>;
return <span>{(info.getValue() as StudentUser)?.studentID || "N/A"}</span>;
},
}),
...(displaySelection