Added new columns to the statistical page
This commit is contained in:
@@ -72,6 +72,7 @@ interface Item {
|
|||||||
result?: AssignmentResult
|
result?: AssignmentResult
|
||||||
assignment: Assignment
|
assignment: Assignment
|
||||||
exams: Exam[]
|
exams: Exam[]
|
||||||
|
entity: Entity
|
||||||
session?: Session
|
session?: Session
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,13 +125,14 @@ export default function Statistical({ user, students, entities, assignments, ses
|
|||||||
filteredAssignments.filter(a => selectedEntities.includes(a.entity || "")).flatMap(a => a.assignees.map(x => {
|
filteredAssignments.filter(a => selectedEntities.includes(a.entity || "")).flatMap(a => a.assignees.map(x => {
|
||||||
const result = findBy(a.results, 'user', x)
|
const result = findBy(a.results, 'user', x)
|
||||||
const student = findBy(students, 'id', x)
|
const student = findBy(students, 'id', x)
|
||||||
|
const entity = findBy(entities, 'id', a.entity)
|
||||||
const assignmentExams = exams.filter(e => a.exams.map(x => `${x.id}_${x.module}`).includes(`${e.id}_${e.module}`))
|
const assignmentExams = exams.filter(e => a.exams.map(x => `${x.id}_${x.module}`).includes(`${e.id}_${e.module}`))
|
||||||
const session = sessions.find(s => s.assignment?.id === a.id && s.user === x)
|
const session = sessions.find(s => s.assignment?.id === a.id && s.user === x)
|
||||||
|
|
||||||
if (!student) return undefined
|
if (!student) return undefined
|
||||||
return { student, result, assignment: a, exams: assignmentExams, session }
|
return { student, result, assignment: a, exams: assignmentExams, session, entity }
|
||||||
})).filter(x => !!x) as Item[],
|
})).filter(x => !!x) as Item[],
|
||||||
[students, selectedEntities, filteredAssignments, exams, sessions]
|
[students, selectedEntities, filteredAssignments, exams, sessions, entities]
|
||||||
)
|
)
|
||||||
|
|
||||||
const sortedData: Item[] = useMemo(() => data.sort((a, b) => {
|
const sortedData: Item[] = useMemo(() => data.sort((a, b) => {
|
||||||
@@ -179,10 +181,18 @@ export default function Statistical({ user, students, entities, assignments, ses
|
|||||||
header: "E-mail",
|
header: "E-mail",
|
||||||
cell: (info) => info.getValue(),
|
cell: (info) => info.getValue(),
|
||||||
}),
|
}),
|
||||||
|
columnHelper.accessor("entity.label", {
|
||||||
|
header: "Entity",
|
||||||
|
cell: (info) => info.getValue(),
|
||||||
|
}),
|
||||||
columnHelper.accessor("assignment.name", {
|
columnHelper.accessor("assignment.name", {
|
||||||
header: "Assignment",
|
header: "Assignment",
|
||||||
cell: (info) => info.getValue(),
|
cell: (info) => info.getValue(),
|
||||||
}),
|
}),
|
||||||
|
columnHelper.accessor("assignment.startDate", {
|
||||||
|
header: "Date",
|
||||||
|
cell: (info) => moment(info.getValue()).format("DD/MM/YYYY"),
|
||||||
|
}),
|
||||||
columnHelper.accessor("result", {
|
columnHelper.accessor("result", {
|
||||||
header: "Progress",
|
header: "Progress",
|
||||||
cell: (info) => {
|
cell: (info) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user