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

@@ -614,6 +614,7 @@ export default function MasterCorporateDashboard({user}: Props) {
allowDownload allowDownload
reload={reloadAssignments} reload={reloadAssignments}
allowArchive allowArchive
allowExcelDownload
/> />
))} ))}
</div> </div>
@@ -630,6 +631,7 @@ export default function MasterCorporateDashboard({user}: Props) {
allowDownload allowDownload
reload={reloadAssignments} reload={reloadAssignments}
allowUnarchive allowUnarchive
allowExcelDownload
/> />
))} ))}
</div> </div>

View File

@@ -260,6 +260,7 @@ export default function TeacherDashboard({user}: Props) {
allowDownload allowDownload
reload={reloadAssignments} reload={reloadAssignments}
allowArchive allowArchive
allowExcelDownload
/> />
))} ))}
</div> </div>
@@ -276,6 +277,7 @@ export default function TeacherDashboard({user}: Props) {
allowDownload allowDownload
reload={reloadAssignments} reload={reloadAssignments}
allowUnarchive allowUnarchive
allowExcelDownload
/> />
))} ))}
</div> </div>

View File

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