Skip to content
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

Merged
merged 7 commits into from
Aug 24, 2023

Conversation

rekhaDevs
Copy link

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • Ran Test A
  • Ran Test B

Test Configuration:

  • Software versions: Nodejs 8.11.2
  • Hardware versions:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@rekhaDevs rekhaDevs changed the title co-316: changes Issue #CO-229 #CO-230 #CO-316 fix: {Reraising PR on release-6.0.0} Apr 5, 2023
@abhay-samagra
Copy link

@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),
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without altering Margin:
image
With altering Margin:
image

@@ -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]]);
Copy link
Contributor

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.

const ProgramServiceHelper = require("../../helpers/programHelper");
const programServiceHelper = new ProgramServiceHelper();
const optionLabelling = {
english: {i: 'I', ii: 'II', iii: 'III', iv: 'IV'},
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Author

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?

@@ -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]]);
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Author

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?

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]]);
Copy link
Contributor

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,
      });
    }
  }

Copy link
Contributor

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.

Copy link
Author

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

Copy link
Author

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",
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Author

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) {
Copy link
Contributor

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.

@vaivk369 @shubhambansaltarento

Copy link
Author

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.

src/service/print/docxHelper.js Outdated Show resolved Hide resolved
@@ -711,8 +713,8 @@ function displayNumber(data) {
type: WidthType.DXA,
},
margins: {
top: convertInchesToTwip(0.0693701),
bottom: convertInchesToTwip(0.0693701),
top: convertInchesToTwip(0.0093701),
Copy link
Contributor

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.

@vinukumar-vs vinukumar-vs changed the base branch from release-6.0.0 to release-6.0.1 August 24, 2023 04:49
@vinukumar-vs vinukumar-vs merged commit 905e421 into Sunbird-coKreat:release-6.0.1 Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants