Skip to content

Conversation

@louwie17
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

Make sure we add a distinct to the totals query so duplicate order id's are not included.
This is possible because of the left join used for the included product filter.

Closes #32220

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Before loading this branch, build latest of trunk
  2. Start a new store, finish the onboarding, and load the sample products in Step 7 (personalize your store) or import these products -> https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/sample-data/sample_products.csv
  3. Set up payments ( I usually select cash on delivery )
  4. Create a new order through the store, adding two different variable products of the same product (ex: Hoodie - Red, Hoodie - Green ) and checkout.
  5. Go to WooCommerce > Status > Scheduled Actions and make sure there are no outstanding actions left (there is usually one daily one), if there is more then one, you can click run on each item to finish it.
  6. Go to Analytics > Orders a single order should be displayed
  7. Now select an advanced filter and select the Products filter. Search for your variable product (in my case: Hoodie) and select that.
  8. The order should still be displayed, now click Download within the table. Notice how it shows a notice that the report will be emailed to you (but if you install the Email log plugin you will notice that won't happen). Technically it should only email reports if the order size is larger then the page size, so in this case you can see it's a bug.
  9. Remove the advanced filter and click Download again, notice how it does allow you to download it right away.
  10. Now load and build this branch
  11. Add the advanced filter for the specific product again (Hoodie)
  12. Click Download and notice how it shows the popup to immediately download the reports.
  13. You can also check the network panel and look for the wc-analytics/reports/orders? request and check if the X-WP-Total response header returns the correct order number ( it will return a bigger number on trunk )

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you created a changelog file for each project being changed, ie pnpm --filter=<project> changelog add?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@louwie17 louwie17 requested a review from a team December 14, 2022 09:57
@github-actions github-actions bot added focus: react admin plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Dec 14, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 14, 2022

Test Results Summary

Commit SHA: ae0d77f

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 54s
E2E Tests187006019316m 19s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@louwie17 louwie17 force-pushed the fix/32220_no_email_report_on_product_filter branch from 12b5c5c to ae0d77f Compare December 15, 2022 13:44
@octaedro octaedro requested review from octaedro and removed request for a team December 21, 2022 15:34
Copy link
Contributor

@octaedro octaedro left a comment

Choose a reason for hiding this comment

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

Good job @louwie17! This is testing well here and code LGTM :shipit:

@louwie17 louwie17 merged commit 60f2ced into trunk Dec 22, 2022
@louwie17 louwie17 deleted the fix/32220_no_email_report_on_product_filter branch December 22, 2022 14:13
@github-actions github-actions bot added this to the 7.4.0 milestone Dec 22, 2022
joelclimbsthings pushed a commit that referenced this pull request Jan 6, 2023
* Make sure order total count uses distinct for order ids

* Add unit test for order count bug

* Add changelog

* Fix lint errors

* Fix lint errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When requesting to download a Revenue Report for the Last Month no report is emailed

3 participants