Commit 557b5d44 authored by snehar-nd's avatar snehar-nd
Browse files

CSV- correct answer in mcq "SB-29415"

Showing with 16 additions and 4 deletions
+16 -4
......@@ -38,10 +38,12 @@ async function printDocx(req, res) {
};
res.send(resJSON);
} else {
let fileName = encodeURIComponent(filename, "UTF-8");
res.setHeader(
"Content-Disposition",
`attachment; filename=${filename}.docx`
`attachment; filename=${fileName}.docx`
);
res.setHeader("Content-type", "text/docx; charset=utf-8");
res.send(Buffer.from(binary, "base64"));
}
} else {
......@@ -75,10 +77,12 @@ async function printDocx(req, res) {
};
res.send(resJSON);
} else {
let fileName = encodeURIComponent(filename, "UTF-8");
res.setHeader(
"Content-Disposition",
`attachment; filename=${filename}.docx`
`attachment; filename=${fileName}.docx`
);
res.setHeader("Content-type", "text/docx; charset=utf-8");
res.send(Buffer.from(binary, "base64"));
}
} else {
......@@ -118,9 +122,10 @@ async function printCSV(req, res) {
};
res.send(resJSON);
} else {
let fileName = encodeURIComponent(filename, "UTF-8");
res.setHeader(
"Content-disposition",
`attachment; filename=${filename}.csv`
`attachment; filename=${fileName}.csv`
);
res.setHeader("Content-type", "text/csv; charset=utf-8");
res.send(binary);
......
......@@ -249,6 +249,12 @@ async function getStack(htmlString, questionCounter) {
return stack;
}
const ansIndex = (arr) => {
for (let index = 0; index < arr.length; index++) {
const element = arr[index];
if (element.answer === true) return index+1
}
}
async function renderMCQ(
question,
questionCounter,
......@@ -368,6 +374,7 @@ async function renderMCQ(
}
}
}
let answer = await ansIndex(question.editorState.options)
let data = {
Class: grade,
Subject: subject,
......@@ -377,7 +384,7 @@ async function renderMCQ(
Option2: questionOptions.length !== 0 ? questionOptions[1][0] : "",
Option3: questionOptions.length !== 0 ? questionOptions[2][0] : "",
Option4: questionOptions.length !== 0 ? questionOptions[3][0] : "",
"CorrectAnswer(1/2/3/4)": question.answer,
"CorrectAnswer(1/2/3/4)": answer,
Competencies: learningOutcome,
Skills: blooms,
QuestionImageUrl: queurl,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment