Solved a bug for the master statistical
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user