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

Automatically clear transient upon settings change #37

Merged
merged 6 commits into from
Jun 26, 2020

Conversation

stevegrunwell
Copy link
Contributor

This PR introduces logic to automatically delete the "limit_orders_order_count" transient any time the "limit_orders" option changes.

Additionally, if a store owner visits the settings screen while there's at least one order within the current interval, they will be warned that the order limiting will be recalculated using the new values.

Finally, the PR refactors the test suite a bit so we have a base TestCase class, giving us the ability to generate dummy orders from any test method.

Fixes #36.

…in OrderLimiterTest::count_qualifying_orders_should_not_limit_results()

Instead of using the WP default of 10 and generating 24 orders (which takes some time), lower the default setting to 2, then generate 5 orders.

Locally, this has sped up test suite execution by ~10s.
…laced within the current interval, as changing the settings will cause those to be recalculated
@stevegrunwell stevegrunwell added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 26, 2020
@stevegrunwell stevegrunwell requested a review from bswatson June 26, 2020 17:48
@stevegrunwell stevegrunwell added this to the Version 1.3.0 milestone Jun 26, 2020
@bswatson bswatson merged commit db91051 into develop Jun 26, 2020
@bswatson bswatson deleted the feature/clear-transient-on-settings-change branch June 26, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically reset limits when settings are changed
2 participants