Skip to content

Conversation

hutychivan
Copy link
Contributor

@hutychivan hutychivan commented Aug 26, 2022

Description (*)

When creating Excel, the is_numeric function is used to determine the cell type. The is_numeric function returns true for strings of the type "123", "\t123" etc. Then the cells are given the Number type, which when viewed leads to an error and the data is displayed as NaN.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Excel writer produces invalid files for numbers preceded by spaces #33422

Manual testing scenarios (*)

  1. Create an instance of Magento\Framework\Convert\Excel with an ArrayIterator over an array containing a field with a value like ␣123 (i.e. space followed by digits, read ␣ as space).
  2. Call convert on the object.
  3. Try opening the resulting file with a current version of Microsoft Excel or LibreOffice Calc. Previously the value was NaN, now the column type is changed to String and the value is displayed correctly.

Questions or comments

Although the is_numeric and ctype_space functions change their behavior in 8.1, these changes should work correctly on both 7.4 and 8.1.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
@m2-assistant
Copy link

m2-assistant bot commented Aug 26, 2022

Hi @hutychivan. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Aug 26, 2022
@m2-github-services m2-github-services added Partner: Perspective partners-contribution Pull Request is created by Magento Partner labels Aug 26, 2022
@hutychivan
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@hutychivan
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@hutychivan
Copy link
Contributor Author

@magento run Functional Tests CE, Functional Tests EE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@hutychivan
Copy link
Contributor Author

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@hutychivan
Copy link
Contributor Author

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@hutychivan
Copy link
Contributor Author

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@sinhaparul sinhaparul added the Project: Community Picked PRs upvoted by the community label May 19, 2023
@engcom-Lima engcom-Lima added Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it and removed Project: Community Picked PRs upvoted by the community labels May 19, 2023
@engcom-Lima engcom-Lima added the Project: Community Picked PRs upvoted by the community label May 19, 2023
@engcom-Lima
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

engcom-Echo commented May 22, 2023

✔️ QA Passed
Fixed excel writer produces invalid files for numbers preceded by spaces

Manual testing scenario:

  1. Create an instance of Magento\Framework\Convert\Excel with an ArrayIterator over an array containing a field
  2. Call convert or write on the object.
  3. Open the generated file, should contain the encoded value as string but it is coming as number
    Sample code
 $data[] = ['message' => " 1233"]; $convert = new \Magento\Framework\Convert\Excel(new \ArrayIterator($data)); $file = $convert->convert('single_sheet'); $fileName = "test_without_space.xml"; return $this->_fileFactory->create($fileName, $file, DirectoryList::VAR_DIR, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); 

Before: ✖️
Generated file should contain the encoded value as string but it is coming as number
<Data ss:Type="Number"> 1233</Data>
image

After: ✔️
Generated file should contain the encoded value as string
<Data ss:Type="String"> 1233</Data>
image

Build is failing hence moving to Extended Testing

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner: Perspective partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Project: Community Picked PRs upvoted by the community Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
7 participants