magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Issue: Incorrect Data on Magento 2 Dashboard #39137

Open SerhiiMandrykin opened 2 weeks ago

SerhiiMandrykin commented 2 weeks ago

Preconditions and environment

Steps to reproduce

  1. Go to frontend.
  2. Place 2 orders.
  3. Change the creation date of the first order: -20h (in sales_order table)
  4. Go to Magento 2 Dashboard

Expected result

Totals in the dashboard bar are calculated correctly

Actual result

Totals are not calculated correctly: image

Workaround:

  1. Switch to a different timeframe: image
  2. Switch back to 24h: image
  3. The totals are calculated correctly: image

Additional information

This bug was caused by https://github.com/magento/magento2/commit/dd769504d2a56e510b1632e8f1a5f42c9571af52 and this line: $period = $this->getRequest()->getParam('period', $firstPeriod);

Setting $firstPeriod as a default value IS NOT correct because it would be today instead of 24h (see \Magento\Backend\Model\Dashboard\Period::getDatePeriods)

BUT by loading the dashboard there is no period parameter in the request so 24h is pre-selected: image

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 weeks ago

Hi @SerhiiMandrykin. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

SerhiiMandrykin commented 2 weeks ago

I prepared a fix in https://github.com/magento/magento2/pull/39138

m2-assistant[bot] commented 2 weeks ago

Hi @engcom-Bravo. 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:

devchris79 commented 2 weeks ago

Hi @SerhiiMandrykin does the fix work for the circumstances that were outlined in #36199 ?

SerhiiMandrykin commented 2 weeks ago

@devchris79 works well for me

m2-assistant[bot] commented 6 days ago

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:

engcom-Delta commented 6 days ago

Hi @SerhiiMandrykin ,

Thanks for your reporting and collaboration. We have verified the issue in latest 2.4-develop instance and issue is not reproducible . Kindly refer the screenshots.

Steps to reproduce -

  1. Go to frontend.
  2. Place 2 orders.
  3. Check the Dashboard before changing the creation date image
  4. Change the creation date of the first order: -20h (in sales_order table) image
  5. Go to Magento 2 Dashboard, observe data is displaying as expected image

Please let us know if any other steps are needed to be performed. Thanks.