Skip to content

Automatically clear transient upon settings change#37

Merged
bswatson merged 6 commits intodevelopfrom
feature/clear-transient-on-settings-change
Jun 26, 2020
Merged

Automatically clear transient upon settings change#37
bswatson merged 6 commits intodevelopfrom
feature/clear-transient-on-settings-change

Conversation

@stevegrunwell
Copy link
Copy Markdown
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