Skip to content

fix date calculation for report's years interval #22868

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

Merged
merged 3 commits into from
May 23, 2019

Conversation

polkan-msk
Copy link

@polkan-msk polkan-msk commented May 13, 2019

Description (*)

Date->diff returns amount of full years between dates, so when
dateStart = 2018-12-25 and dateEnd = 2019-01-25
$dateStart->diff($dateEnd)->y will be 0, that does not match the code's
logic which expects 1 when year 'from' is not eq to year 'to'

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. go to Reports > Products > Ordered
  2. select dateFrom = 12/1/2018 and dateTo = 01/31/2019
  3. select Show By = Month and Submit
  4. check Total Qty value in the table footer
  5. select Show By = Year and Submit
  6. check Total Qty value in the table footer, it should be the same as it was on step 4.

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)
  • All automated tests passed successfully (all builds are green)

Date->diff returns amount of full years between dates, so when
dateStart = 2018-12-25 and dateEnd = 2019-01-25
$dateStart->diff($dateEnd)->y will be 0, that does not match the code's
logic which expects 1 when year 'from' is not eq to year 'to'
@m2-assistant
Copy link

m2-assistant bot commented May 13, 2019

Hi @polkan-msk. Thank you for your contribution
Here is 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-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented May 13, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@swnsma swnsma left a comment

Choose a reason for hiding this comment

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

Hi @polkan-msk,

Thank you for your contribution!
Your PR looks really great!

But we need to have green build to process the PR.
Could you please check and fix failed static tests?

@swnsma swnsma self-requested a review May 14, 2019 13:34
Copy link
Contributor

@swnsma swnsma left a comment

Choose a reason for hiding this comment

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

@polkan-msk,
Thank you for your changes.

QA, the main idea of the bug that if you select year period in '01-01-2018 - 14-05-2019' it will show statistic for 2 periods: '01-01-2018 - 14-05-2018' and '01-01-2019 - 14-05-2019'

@magento-engcom-team
Copy link
Contributor

Hi @swnsma, thank you for the review.
ENGCOM-5113 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@polkan-msk thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@soleksii
Copy link

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented May 23, 2019

Hi @polkan-msk, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.3 milestone May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants