Closed norgeindian closed 3 months ago
Hi @norgeindian. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
@magento give me 2.4 instance
@magento give me 2.4-develop instance
Hi @victortodoran. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @victortodoran, here is your Magento instance.
Admin access: https://i-29734-2-4-develop.instances.magento-community.engineering/admin_39a7
Login: caeaa300
Password: 8ef7cc6790dc
Instance will be terminated in up to 3 hours.
Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
:white_check_mark: Confirmed by @engcom-Delta
Thank you for verifying the issue. Based on the provided information internal tickets MC-37060
were created
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Just FYI, I beleive the issue is in the logic at lines 453 to 468 of the file D:\wamp64\www\autoglym2.local\vendor\magento\module-reports\Model\ResourceModel\Order\Collection.php
case '2y':
$startMonthDay = explode(
',',
$this->_scopeConfig->getValue(
'reports/dashboard/ytd_start',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$startMonth = isset($startMonthDay[0]) ? (int)$startMonthDay[0] : 1;
$startDay = isset($startMonthDay[1]) ? (int)$startMonthDay[1] : 1;
$dateStart->setDate($dateStart->format('Y'), $startMonth, $startDay);
//$dateStart->modify('-1 year');
if ($range == '2y') {
$dateStart->modify('-1 year');
}
break;
Here, I've commented out line 464 to fix it.
The logic being the line 463
$dateStart->setDate($dateStart->format('Y'), $startMonth, $startDay);
this sets the date to the current year (with start day configs, pretty meaningless), so for today thats "1-1-2020" assuming defaults
line 464 takes a year off, so thats "1-1-2019"
$dateStart->modify('-1 year');
then lines 465 to 467 are if its 2 years to date, take another year off, thats 1-1-2018.
if ($range == '2y') { $dateStart->modify('-1 year'); }
So Year to Date YTD and 2 year to date 2YTD are both incorrectly offset by a year. YTD measn you need to start at the beginning of the current year as is calculated in the first statement.
Then a year is taken off, which is where the error is (note I commented it out in the snippet above)
Then the extra year is correctly taken off for the "2y" case.
Good news is, the containing function is public and on a concrete class so it should be easy to write an plugin around the function to correct. Bad news is, this looks like a generic collection used for many reports, I'm not sure if this would impact anything in the actual reporting area of admin....
@magento I'm working on it,
Hi @kaivanshah02! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team
command to join Contributors team.
@magento I'm working on it.
@magento add to contributors team
Hi @kaivanshah02! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.
@magento I'm working on it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
@kaivanshah02 , any news regarding this topic?
Same problem on 2.3.6-p1. I am interested in a solution. Thanks.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
Still relevant AFAIK.
Definitely, still no solution here as far as I see.
I confirm this is still an issue in 2.3.7-p1
It also still appears in 2.4.2-p1
Still an issue in 2.4.3-p1
Is anyone actually bothering to acknowledge this bug and roll-out a fix?
It was reported over a year ago and is still a present issue in the latest stable release...
Still not correct in Magento 2.4.3-p2
Any updates regarding this issue?
@norgeindian I think Adobe gave up caring about the countless bugs with Magento Open Source edition... 🤷♂️
Still an issue in 2.4.3-p3
@norgeindian we gave up waiting for Magento to fix this themselves and just wrote a module that fixes it as per what @Blatant advised earlier in this thread.
@Blatant did the right fix. Just needs to be included in M2 next release...
@magento I am working on this
@magento give me 2.4-develop instance
Hi @engcom-Delta. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Delta, here is your Magento Instance: https://c636a06a8c812d74973a9e5179ba4e0c.instances-prod.magento-community.engineering Admin access: https://c636a06a8c812d74973a9e5179ba4e0c.instances-prod.magento-community.engineering/admin_061a Login: a7645ec8 Password: 724810383f4a
Hi @norgeindian,
Thank you for reporting and collaboration. Verified the issue on Magento 2.4-develop and the issue is not reproducible. Kindly refer the screenshots.
Steps to Reproduce
Access Admin
Refresh order report
Navigate back to dashboard
Set sort to YTD , observe current year data is displaying in cart.
Set sort to 2YTD , observe data is displaying as expected
Kindly recheck the issue on latest Magento 2.4-develop instance and Please let us know if you are still facing any issue. Thanks.
@engcom-Delta , thanks for checking. But as I wrote in the initial description of the issue, I would usually expect the last 12 resp. 24 months to be shown and not all data of the current resp. the current and the last year.
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
![image](https://user-images.githubusercontent.com/11156287/91152880-ce269b00-e6bf-11ea-9da0-fcce983a9d0a.png) More than 12 months are shown. Everything until beginning of 2019 is shown instead of only the period between August 2019 and August 2020. ![image](https://user-images.githubusercontent.com/51681379/91813789-e0628500-ec3b-11ea-85c2-36fa15f615c3.png) Proposed [solution](https://github.com/magento/magento2/issues/29734#issuecomment-682029009) --- Please provide [Severity](https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#backlog) assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes. - [ ] Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._ - [ ] Severity: **S1** _- Affects critical data or functionality and forces users to employ a workaround._ - [ ] Severity: **S2** _- Affects non-critical data or functionality and forces users to employ a workaround._ - [x ] Severity: **S3** _- Affects non-critical data or functionality and does not force users to employ a workaround._ - [ ] Severity: **S4** _- Affects aesthetics, professional look and feel, “quality” or “usability”._