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

Clean up Ransack query to find orders by promotion #1662

Merged
merged 2 commits into from
Jan 11, 2017

Conversation

stewart
Copy link
Contributor

@stewart stewart commented Dec 21, 2016

This commit optimizes the query used when attempting to find orders that
used a promotion code, by going directly through the
spree_orders_promotions table, resulting in one fewer JOIN in the
resulting query.

As the spree_orders, spree_promotions, and spree_promotion_codes
tables can be quite large for some stores, skipping a JOIN significantly
increase performance for these sorts of queries.

This commit optimizes the query used when attempting to find orders that
used a promotion code, by going directly through the
`spree_orders_promotions` table, resulting in one fewer JOIN in the
resulting query.

As the `spree_orders`, `spree_promotions`, and `spree_promotion_codes`
tables can be quite large for some stores, skipping a JOIN significantly
increase performance for these sorts of queries.
Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@jhawthorn jhawthorn left a comment

Choose a reason for hiding this comment

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

Could this get a changelog entry?

Maybe something like:

Changed the promotion field in the admin order search to only find orders which used the specified promotion code, instead of any code on an applied promotion.

@tvdeyen tvdeyen merged commit 798a3ed into solidusio:master Jan 11, 2017
@stewart stewart deleted the fix/ransack-promotion-codes branch April 25, 2018 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants