Added Student ID to the Master Statistical
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, {useEffect, useMemo, useState} from "react";
|
import React, {useEffect, useMemo, useState} from "react";
|
||||||
import {CorporateUser, User} from "@/interfaces/user";
|
import {CorporateUser, StudentUser, User} from "@/interfaces/user";
|
||||||
import {BsFileExcel, BsBank, BsPersonFill} from "react-icons/bs";
|
import {BsFileExcel, BsBank, BsPersonFill} from "react-icons/bs";
|
||||||
import IconCard from "../IconCard";
|
import IconCard from "../IconCard";
|
||||||
|
|
||||||
@@ -163,6 +163,13 @@ const MasterStatistical = (props: Props) => {
|
|||||||
return <span>{info.getValue()}</span>;
|
return <span>{info.getValue()}</span>;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
columnHelper.accessor("user", {
|
||||||
|
header: "Student ID",
|
||||||
|
id: "studentID",
|
||||||
|
cell: (info) => {
|
||||||
|
return <span>{(info.getValue() as StudentUser).studentID || "N/A"}</span>;
|
||||||
|
},
|
||||||
|
}),
|
||||||
...(displaySelection
|
...(displaySelection
|
||||||
? [
|
? [
|
||||||
columnHelper.accessor("corporate", {
|
columnHelper.accessor("corporate", {
|
||||||
@@ -347,7 +354,7 @@ const MasterStatistical = (props: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
{renderSearch()}
|
{renderSearch()}
|
||||||
<div className="flex flex-col gap-3 justify-end">
|
<div className="flex flex-col gap-3 justify-end">
|
||||||
<Button className="max-w-[200px] h-[70px]" variant="outline" isLoading={downloading} onClick={triggerDownload}>
|
<Button className="w-[200px] h-[70px]" variant="outline" isLoading={downloading} onClick={triggerDownload}>
|
||||||
Download
|
Download
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {checkAccess} from "@/utils/permissions";
|
|||||||
import {getAssignmentsForCorporates} from "@/utils/assignments.be";
|
import {getAssignmentsForCorporates} from "@/utils/assignments.be";
|
||||||
import {search} from "@/utils/search";
|
import {search} from "@/utils/search";
|
||||||
import {getGradingSystem} from "@/utils/grading.be";
|
import {getGradingSystem} from "@/utils/grading.be";
|
||||||
import {User} from "@/interfaces/user";
|
import {StudentUser, User} from "@/interfaces/user";
|
||||||
import {calculateBandScore, getGradingLabel} from "@/utils/score";
|
import {calculateBandScore, getGradingLabel} from "@/utils/score";
|
||||||
import {Module} from "@/interfaces";
|
import {Module} from "@/interfaces";
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ export default withIronSessionApiRoute(handler, sessionOptions);
|
|||||||
|
|
||||||
interface TableData {
|
interface TableData {
|
||||||
user: string;
|
user: string;
|
||||||
|
studentID: string;
|
||||||
email: string;
|
email: string;
|
||||||
correct: number;
|
correct: number;
|
||||||
corporate: string;
|
corporate: string;
|
||||||
@@ -109,10 +110,10 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
const total = userStats.reduce((n, e) => n + e.score.total, 0);
|
const total = userStats.reduce((n, e) => n + e.score.total, 0);
|
||||||
const {label: level, score} = getGradingSystemHelper(a.exams, a.assigner, userData!, correct, total);
|
const {label: level, score} = getGradingSystemHelper(a.exams, a.assigner, userData!, correct, total);
|
||||||
|
|
||||||
console.log("Level", level);
|
|
||||||
const commonData = {
|
const commonData = {
|
||||||
user: userData?.name || "",
|
user: userData?.name || "",
|
||||||
email: userData?.email || "",
|
email: userData?.email || "",
|
||||||
|
studentID: (userData as StudentUser).studentID || "",
|
||||||
userId: assignee,
|
userId: assignee,
|
||||||
corporateId: a.corporateId,
|
corporateId: a.corporateId,
|
||||||
corporate: corporateUser?.name || "",
|
corporate: corporateUser?.name || "",
|
||||||
@@ -164,6 +165,10 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
label: "Email",
|
label: "Email",
|
||||||
value: (entry: TableData) => entry.email,
|
value: (entry: TableData) => entry.email,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Student ID",
|
||||||
|
value: (entry: TableData) => entry.studentID,
|
||||||
|
},
|
||||||
...(displaySelection
|
...(displaySelection
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user