Skip to content
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

Sales reporting fixes and improvements #2859

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open

Conversation

brianhogg
Copy link
Contributor

@brianhogg brianhogg commented Jan 23, 2025

Description

  • Fix for date range not including orders/transactions after 23:23:59 on the last day of the date range
  • Updating the date range code on other widgets to use the recommended/safe method of fetching data between two dates
  • Adds new "# of Transactions" widget
  • "Net Sales" is now the calculation of the transaction amount minus any amount refunded, regardless of the status of the associated order
  • "# of sales" now includes Orders with status “On Hold” “Expired” “Pending Cancellation” and “Cancelled”

Fixes #2858, #2860, #2861

How has this been tested?

Manually

CleanShot 2025-01-24 at 11  42 52@2x

Checklist:

  • This PR requires and contains at least one changelog file.
  • My code has been tested.
  • My code passes all existing automated tests.
  • My code follows the LifterLMS Coding & Documentation Standards.

…reased precision with MySQL, and less than (vs. the inclusive BETWEEN) to avoid including transactions at 00:00:00 on the next day.
@brianhogg brianhogg added this to the Next Available Release milestone Jan 23, 2025
@brianhogg brianhogg requested a review from ideadude as a code owner January 23, 2025 20:10
@brianhogg brianhogg changed the title Updating to use the next day in the date range Sales reporting fixes and improvements Jan 24, 2025
@@ -68,7 +66,7 @@ public function get_widget_data() {
'title' => __( '# of Sales', 'lifterlms' ),
'cols' => '1-4',
'content' => __( 'loading...', 'lifterlms' ),
'info' => __( 'Number of new active or completed orders placed within this period', 'lifterlms' ),
'info' => __( 'Number of new non-refunded orders placed within this period', 'lifterlms' ),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly sanitize translation string

@brianhogg
Copy link
Contributor Author

Investigate using JOIN instead of a subquery for the SUM portion, and maybe using another JOIN or a sub-query for the "IN" of what order IDs are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Awaiting Review
Development

Successfully merging this pull request may close these issues.

2 participants