Skip to content

Commit

Permalink
Issue #CO-949: logs for print preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Bansal authored and Shubham Bansal committed May 21, 2024
1 parent 8fb4a99 commit 891260e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/service/print/printDocxV1.0/dataImporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const QS_HIERARCHY_READ_URL = `${envVariables.SUNBIRD_ASSESSMENT_SERVICE_BASE_UR


const getQuestionForSet = async (id) => {
console.log("getQuestionForSet", id)
let url= `${QUE_READ_URL}${id}?fields=${fields}`
const request = {
url: url,
Expand All @@ -28,13 +29,15 @@ const getQuestionForSet = async (id) => {
return axios(request).then((r) => {
return r.data.result.question;
}).catch((e)=>{
console.log("errorGetQuestionForSet", e)
return{
error:true,
errormsg:"wrong ID"
}
})
};
const getQuestionSet = async (config) => {
console.log("configInDataImporter", config);
const id = config.id;
const headers = {
Authorization: "Bearer " + envVariables.SUNBIRD_PORTAL_API_AUTH_TOKEN
Expand Down Expand Up @@ -109,6 +112,7 @@ const getQuestionSet = async (config) => {
});
})
.catch((e) => {
console.log("dataImporterError", e);
error = true;
errorMsg = "Uncaught Exception";
return {
Expand Down
4 changes: 4 additions & 0 deletions src/service/print/printDocxV1.0/docx.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ const buildDOCX_1_WithCallback = async (config, callback) => {
let totalMarks = 0;
getQuestionSet(config)
.then(async (data) => {
console.log("data", data);
if (data.error) {
console.log("data.error", data.error);
callback(null, data.error, data.errorMsg);
} else {
console.log("config", config);
let subject, grade, examName, instructions, language, description;
if(data.instructions) instructions = data.instructions;
if (data.paperData) {
Expand Down Expand Up @@ -145,6 +148,7 @@ const buildDOCX_1_WithCallback = async (config, callback) => {
}
})
.catch((e) => {
console.log("getQuestionSetError", e);
error = true;
errorMsg = "";
callback(null, error, errorMsg);
Expand Down

0 comments on commit 891260e

Please sign in to comment.