Added download option to master Corporate and teacher

This commit is contained in:
Joao Ramos
2024-08-20 01:15:43 +01:00
parent bf5dd62b35
commit 1cd4dfc397
3 changed files with 6 additions and 10 deletions

View File

@@ -182,8 +182,6 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
worksheet.getCell(`B${index + 1}`).value = value; // Second column (values)
});
logWorksheetData(worksheet);
// Define the static part of the headers (before "Test Sections")
const staticHeaders = [
"Sr N",
@@ -216,8 +214,6 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
// 1 headers rows
const startIndexTable = firstSectionData.length + 1;
logWorksheetData(worksheet);
// // Merge "Test Sections" over dynamic number of columns
// const tableColumns = staticHeaders.length + numberOfTestSections;
worksheet.mergeCells(
@@ -227,10 +223,6 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
tableColumnHeadersFirstPart.length
);
// logWorksheetData(worksheet);
// worksheet.mergeCells(`G1:G3`); // Time Spent
// worksheet.mergeCells(`H1:H3`); // Score
// worksheet.mergeCells(`I1:I3`); // Level
// Add the dynamic second and third header rows for test sections and sub-columns
worksheet.addRow([
@@ -277,10 +269,10 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
return `${score.correct}/${score.total}`;
}),
`${
data.stats.reduce(
Math.ceil(data.stats.reduce(
(acc: number, curr: any) => acc + curr.timeSpent,
0
) / 60
) / 60)
} minutes`,
data.correct,
]);