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.56k stars 9.32k forks source link

Wrong dashboard totals with aggregated data #36875

Closed gexxx05 closed 1 year ago

gexxx05 commented 1 year ago

Preconditions and environment

Steps to reproduce

  1. Create some orders in your shop for testing (you need some older orders in the past few days)
  2. Enable dashboard chart and use aggregated data
  3. In dashboard select "Order" tab and in dropdown select "Today" screen03
  4. Change dropdown to "Last 24 hours" screen04

Expected result

The totals below the chart should be different.

Actual result

The totals are the same whether i select "Today" or "Last 24 hours".

Additional information

The sql select for "Today": SELECT SUM(main_table.total_revenue_amount) AS revenue, SUM(main_table.total_tax_amount_actual) AS tax, SUM(main_table.total_shipping_amount_actual) AS shipping, SUM(orders_count) AS quantity FROM sales_order_aggregated_created AS main_table WHERE (period >= '2023-02-16 00:00:00' AND period <= '2023-02-16 23:59:59') AND (main_table.order_status NOT IN('Canceled')) AND (store_id = '0')

And here the result without the SUM: screen05

The sql select for "Last 24 hours": SELECT SUM(main_table.total_revenue_amount) AS revenue, SUM(main_table.total_tax_amount_actual) AS tax, SUM(main_table.total_shipping_amount_actual) AS shipping, SUM(orders_count) AS quantity FROM sales_order_aggregated_created AS main_table WHERE (period >= '2023-02-15 11:58:12' AND period <= '2023-02-16 11:58:12') AND (main_table.order_status NOT IN('Canceled')) AND (store_id = '0')

And here the result without the SUM: screen06

The result stay the same and so the total values. The problem is, that the field "period" in "sales_order_aggregated_created" is a date field and not datetime. The graph is also messed up because of this problem.

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

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

m2-assistant[bot] commented 1 year 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 1 year ago

Hi @gexxx05, this is a repeat of my issue #36199 by the looks of it.

gexxx05 commented 1 year ago

Hi @devchris79, Sorry, I didn't see your issue, although I was looking for related ones.

However, my problem does not only occur on page load and is more related to aggregate data. The problem is with the options today and 24h, because with aggregate data there is no time reference and so the result is not correct. When i switch to live data the sql selects table sales_order and field created_at which is a timestamp and so the result is correct.

But i can confirm that i have the same behaviour as you described in your issue. On the first load the today data is not correct, but if i switch to 24h and then back again, its correct.

Thank you

m2-assistant[bot] commented 1 year ago

Hi @engcom-Alfa. 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-Bravo commented 1 year ago

@devchris79 Thanks for your contribution & collaboration over here.

Hi @gexxx05,

Thanks for your contribution & collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is reproducible but There is an ongoing confirmed issue https://github.com/magento/magento2/issues/36199 for the same. Kindly move on to this issue for latest updates / solutions on the same.

We are closing this as duplicate.

Thanks.

gexxx05 commented 1 year ago

Thanks, but this is not the same as https://github.com/magento/magento2/issues/36199. I have already described it here: https://github.com/magento/magento2/issues/36875#issuecomment-1434415074

engcom-Bravo commented 1 year ago

@gexxx05 we have updated the main description of ongoing confirmed issue https://github.com/magento/magento2/issues/36199

Thanks.

gexxx05 commented 1 year ago

You're mixing things up here. The description for this problem is only valid in this specific case if the setting "Use Aggregated Data" is set to "Yes". The issue https://github.com/magento/magento2/issues/36199 has nothing to do with aggregated data at all and is already fixed with https://github.com/magento/magento2/commit/dd769504d2a56e510b1632e8f1a5f42c9571af52.

So I would not just copy descriptions together even though the issues are different. But i will leave it for now.