-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #CO-229 #CO-230 #CO-316 fix: {Reraising PR on release-6.0.0} #303
Conversation
@vinukumar-vs - Please have a look at the PR. |
@@ -711,8 +713,8 @@ function displayNumber(data) { | |||
type: WidthType.DXA, | |||
}, | |||
margins: { | |||
top: convertInchesToTwip(0.0693701), | |||
bottom: convertInchesToTwip(0.0693701), | |||
top: convertInchesToTwip(0.0093701), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the right way of fixing the margins. It should be common across all sides. Any specific reason why the margins are different for the document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While printing paper having MCQ questions, the line height between line 1 of options and line 2 of options was a bit higher. It was done to reduce the line height space to consume less physical paper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not convinced.. Can you share the snapshot of the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/service/print/docxHelper.js
Outdated
@@ -270,20 +275,20 @@ async function renderMCQ(question, questionCounter, marks) { | |||
typeof questionOptions[0][0] === "object" | |||
) { | |||
if (questionOptions[0][0].text) { | |||
questionOpt.push(["I.", questionOptions[0][0].text[1]]); | |||
questionOpt.push([`${getLanguageKey(printLanguage, 'i')+")"}`, questionOptions[0][0].text[1]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vaivk369 suggest the better approach of pushing the question to the array.
src/service/print/docxHelper.js
Outdated
const ProgramServiceHelper = require("../../helpers/programHelper"); | ||
const programServiceHelper = new ProgramServiceHelper(); | ||
const optionLabelling = { | ||
english: {i: 'I', ii: 'II', iii: 'III', iv: 'IV'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the using the keys as i, ii, iii, iv, why can't it be just an array of strings?
optionLabelling = {
"en": ["I", "II", "III" ......],
"hi": ["क", "ख", "ग" ......]
}
This should be configuration driven. should not hardcode here. Later if we want another language, it should be config change. Code should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes will be implementing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I resolve this conversation, as this one is implemented?
src/service/print/docxHelper.js
Outdated
@@ -297,20 +302,20 @@ async function renderMCQ(question, questionCounter, marks) { | |||
typeof questionOptions[1][0] === "object" | |||
) { | |||
if (questionOptions[1][0].text) { | |||
questionOpt.push(["II.", questionOptions[1][0].text[1]]); | |||
questionOpt.push([`${getLanguageKey(printLanguage, 'ii')+")"}`, questionOptions[1][0].text[1]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should I use the same key "II" for all the languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cause there must be default options labeling in case of undefined language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I resolve this conversation?
src/service/print/docxHelper.js
Outdated
imageProperties.push({ | ||
width: questionOptions[0][0].width, | ||
height: questionOptions[0][0].height, | ||
}); | ||
} | ||
} else { | ||
questionOpt.push(["I.", questionOptions[0][0]]); | ||
questionOpt.push([`${getLanguageKey(printLanguage, 'i')+")"}`, questionOptions[0][0]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't you move the entire this logic into different function as pass the index to it
for loop
setOption(index, questionOptions)
function setOption(index, questionOptions)
if (questionOptions[index] !== undefined) {
if (
questionOptions[index][0] !== undefined &&
typeof questionOptions[index][0] === "object"
) {
if (questionOptions[index][0].text) {
questionOpt.push([`${getLanguageKey(printLanguage, index)+")"}`, questionOptions[index][0].text[1]]);
imageProperties.push({
width: 0,
height: 0,
});
} else {
questionOpt.push([`${getLanguageKey(printLanguage, index+1)+")"}`, questionOptions[index][0].image]);
imageProperties.push({
width: questionOptions[index][0].width,
height: questionOptions[index][0].height,
});
}
} else {
questionOpt.push([`${getLanguageKey(printLanguage, index+1)+")"}`, questionOptions[index][0]]);
imageProperties.push({
width: 0,
height: 0,
});
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way if there are only 2 option or more than 4 also the code will works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done @vinukumar-vs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I resolve this conversation, as this is implemented too?
@@ -0,0 +1,9 @@ | |||
{ | |||
"studentName" : "Student Name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files should be taken from blob rather than adding to the code repo. Any new language should not require any code code, it will be configuration driven.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where must i save these language files and how we will be using them. If there is any reference, please share.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vaivk369 , please help me with this if you can.
@@ -394,6 +297,36 @@ async function renderMCQ(question, questionCounter, marks) { | |||
return data; | |||
} | |||
|
|||
function setOptions(questionOptions, questionOpt, imageProperties, printLanguage, i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope you enjoyed writing the code.. looks fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i did, Thank you for guidance.
@@ -711,8 +713,8 @@ function displayNumber(data) { | |||
type: WidthType.DXA, | |||
}, | |||
margins: { | |||
top: convertInchesToTwip(0.0693701), | |||
bottom: convertInchesToTwip(0.0693701), | |||
top: convertInchesToTwip(0.0093701), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not convinced.. Can you share the snapshot of the UI.
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Type of change
Please choose appropriate options.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes in the below checkboxes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: