-
Notifications
You must be signed in to change notification settings - Fork 41
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
Update order modifier queries #3479
base: release/T25.imp
Are you sure you want to change the base?
Conversation
This makes interpolation easier
* @test | ||
* @return void | ||
*/ | ||
public function should_find_all_fees() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that the most crucial functionality introduced is covered by this test case ? If not, could we become please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dimi brought up some other things in Slack, so I'm not going to cover that here.
src/Tickets/Commerce/Order_Modifiers/Modifiers/Modifier_Abstract.php
Outdated
Show resolved
Hide resolved
src/Tickets/Commerce/Order_Modifiers/Table_Views/Order_Modifier_Table.php
Outdated
Show resolved
Hide resolved
src/Tickets/Commerce/Order_Modifiers/Table_Views/Order_Modifier_Table.php
Outdated
Show resolved
Hide resolved
// Set the items for the table. | ||
$this->items = $data; | ||
// Get the total number of items. | ||
$total_items = $this->modifier->find_count_by_search( [ 'search_term' => $search ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does a second query - can't we just count the results above (pre-limit)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we just count the results above (pre-limit)?
Doing that, we'd need to run a query without the limit in place. Otherwise the limit will mean we only get the count according to the limit.
I did some research into the counting. I had intended to use SQL_CALC_FOUND_ROWS
(the way WP_Query
does it), and what I found was that it was less efficient than doing a second COUNT()
query for the same results (minus the limits).
🎫 Ticket
ET-2268
🗒️ Description
This PR makes the following changes to the order modifier database queries:
QueryBuilder
objects to create the queries instead of relying on direct stringslimit
- limit the number of results returned, with a default of 10.order
- specify ordering ASC or DESC.orderby
- specify what column to order the results by. Defaults toid
.offset
- specify how many results to skip before returning results.page
- specify what page of results to retrieve. Overridesoffset
.status
- specify an array of statuses for the results🎥 Artifacts
✔️ Checklist
npm run changelog
to add changelog file(s). More info herewpunit
orintegration
tests.wpunit
orintegration
tests.