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

Version 1.1.2 #14

Merged
merged 3 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Version 1.1.2] - 2020-04-17

### Fixed

* Override WordPress' default `LIMIT` on queries, which was preventing stores with limits > 10 from stopping orders ([#13]).


## [Version 1.1.1] — 2020-04-16

### Fixed
Expand Down Expand Up @@ -31,7 +38,9 @@ Initial plugin release.
[Version 1.0.0]: https://github.com/nexcess/limit-orders/releases/tag/v1.0.0
[Version 1.1.0]: https://github.com/nexcess/limit-orders/releases/tag/v1.1.0
[Version 1.1.1]: https://github.com/nexcess/limit-orders/releases/tag/v1.1.1
[Version 1.1.2]: https://github.com/nexcess/limit-orders/releases/tag/v1.1.2
[#5]: https://github.com/nexcess/limit-orders/pull/5
[#6]: https://github.com/nexcess/limit-orders/pull/6
[#8]: https://github.com/nexcess/limit-orders/pull/8
[#10]: https://github.com/nexcess/limit-orders/pull/10
[#13]: https://github.com/nexcess/limit-orders/pull/13
2 changes: 1 addition & 1 deletion limit-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author URI: https://nexcess.net
* Text Domain: limit-orders
* Domain Path: /languages
* Version: 1.1.1
* Version: 1.1.2
*
* WC requires at least: 3.9
* WC tested up to: 4.0
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: WooCommerce, ordering, limits, throttle
Requires at least: 5.3
Tested up to: 5.4
Requires PHP: 7.0
Stable tag: 1.1.1
Stable tag: 1.1.2
License: MIT
License URI: https://github.com/nexcess/limit-orders/blob/master/LICENSE.txt

Expand Down Expand Up @@ -45,6 +45,9 @@ Yes, the order creation process through WP Admin is unaffected.

For a complete list of changes, please [see the plugin's changelog on GitHub](https://github.com/nexcess/limit-orders/blob/master/CHANGELOG.md).

= 1.1.2 (2020-04-17) =
* Override WordPress' default "LIMIT" on queries, which was preventing stores with limits > 10 from stopping orders

= 1.1.1 (2020-04-16) =
* Prevent errors from occurring in WP Admin due to the customer-facing notice

Expand All @@ -56,5 +59,8 @@ Initial release of the plugin.

== Upgrade Notice ==

= 1.1.2 =
Fixes error that was preventing order limiting from working on stores with limits higher than 10.

= 1.1.1 =
Fixes errors in WP Admin after a store's order limit has been reached.
1 change: 1 addition & 0 deletions src/OrderLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ protected function count_qualifying_orders() {
'type' => wc_get_order_types( 'order-count' ),
'date_created' => '>=' . $this->get_interval_start()->getTimestamp(),
'return' => 'ids',
'limit' => max( $this->get_limit(), 1000 ),
] );

return count( $orders );
Expand Down
15 changes: 15 additions & 0 deletions tests/OrderLimiterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,21 @@ public function the_transient_should_be_updated_each_time_an_order_is_placed() {
}
}

/**
* @test
*/
public function count_qualifying_orders_should_not_limit_results() {
for ( $i = 0; $i < 24; $i++ ) {
$this->generate_order();
}

$instance = new OrderLimiter();
$method = new \ReflectionMethod( $instance, 'count_qualifying_orders' );
$method->setAccessible( true );

$this->assertSame( 24, $method->invoke( $instance ) );
}

/**
* Create a new order by emulating the checkout process.
*/
Expand Down