diff --git a/src/exams/pdf/index.tsx b/src/exams/pdf/index.tsx index 846364b1..a81e403d 100644 --- a/src/exams/pdf/index.tsx +++ b/src/exams/pdf/index.tsx @@ -29,9 +29,11 @@ interface Props { logo: string; qrcode: string; renderDetails: React.ReactNode; + title: string; } const PDFReport = ({ + title, date, name, email, @@ -68,7 +70,7 @@ const PDFReport = ({ { fontSize: 14 }, ]} > - English Skills Test Result Report + {title} diff --git a/src/pages/api/stats/[id]/export.tsx b/src/pages/api/stats/[id]/export.tsx index 0b08696f..df16461a 100644 --- a/src/pages/api/stats/[id]/export.tsx +++ b/src/pages/api/stats/[id]/export.tsx @@ -303,12 +303,6 @@ async function post(req: NextApiRequest, res: NextApiResponse) { ); const overallResult = overallScore / overallTotal; - // generate the performance summary based on the overall result - const performanceSummary = getPerformanceSummary( - "level", - overallResult - ); - // generate the overall detail report const overallDetail = { module: "Overall", @@ -319,16 +313,32 @@ async function post(req: NextApiRequest, res: NextApiResponse) { const testDetails = [overallDetail, ...finalResults]; const [stat] = stats; + + // generate the performance summary based on the overall result + const performanceSummary = getPerformanceSummary( + stat.module, + overallResult + ); + // level exams have a different report structure than the skill exams - const renderDetails = () => { + const getCustomData = () => { if (stat.module === "level") { - return ; + return { + title: "ENGLISH LEVEL TEST RESULT REPORT ", + details: , + }; } - return ; + return { + title: "ENGLISH SKILLS TEST RESULT REPORT", + details: , + }; }; + + const { title, details } = getCustomData(); const pdfStream = await ReactPDF.renderToStream(