Commit Graph

29 Commits

Author SHA1 Message Date
Joshua T Flowers 746d062f09 Check and update customer first orders to fix returning_customers (https://github.com/woocommerce/woocommerce-admin/pull/1517)
* Add get_oldest_orders function to customer data store

* Check if is first order in is_returning_customer()

* Check if the customers first order has changed and update all orders respectively

* Fix check for empty oldest_orders array

* Change avg_items_per_order to number instead of integer

* Fix failing tests for new/returning customers

Only the first orders with product 1 and without coupons should be new per each customer

* Remove sleep functions from tests

* Assign second order to a variable for legibility

* Fix second order assignment and check if set
2019-02-14 11:14:01 +08:00
Jeff Stieler 9762810b70 Support ReportTable search in customers report (list of customer IDs). 2019-02-12 11:08:33 -08:00
Jeff Stieler e36d25e112 Make customer object IDs compatible with `wc-api`/`fresh-data`. 2019-02-12 11:08:03 -08:00
Jeff Stieler 926fdcfb97 Hook `v4/customers` endpoint up to customers report/lookup table and change name search to be fuzzy. 2019-02-12 11:06:22 -08:00
Joshua T Flowers b7379def1b Format todo comments to match WC Core format (https://github.com/woocommerce/woocommerce-admin/pull/1474)
* Format todo comments to match WC Core format

* Remove variations todo comment
2019-02-06 14:41:53 +08:00
Claudio Sanches a1976bc1bc Improve action/hook naming 2019-02-04 15:58:37 -02:00
Claudio Sanches 8c0c01a3da Merge branch 'master' into feature/754 2019-02-01 18:27:23 -02:00
Peter Fabian 32f851be5b Merge pull request woocommerce/woocommerce-admin#1286 from woocommerce/fix/1035
Added segmenting support to REST API
2019-02-01 20:50:38 +01:00
Claudio Sanches 707067e255 Docblocks 2019-02-01 17:02:15 -02:00
Claudio Sanches 07f3f33566 Introduced new hooks for jetpack sync 2019-02-01 15:43:24 -02:00
Peter Fabian e56009cfdc Updated todo format to be in line with the rest of WooCommerce. 2019-01-29 13:29:50 +01:00
Paul Sealock bca0785e64 Customers Report: support between args for dates 2019-01-29 08:58:07 +13:00
Joshua T Flowers 9c9ff13c2b Allow customer date_last_active to be null (https://github.com/woocommerce/woocommerce-admin/pull/1377)
* Allow customer date_last_active to be null

* Only show last active in customers report table if set
2019-01-25 09:37:50 -08:00
Joshua T Flowers 33a7cfa1b0 Store all order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1285)
* Store all orders regardless of status in wc_order_stats

* Only query select statuses if status_is or status_is_not is not set

* Fix order stats example query

* Filter category store by default order statuses

* Add table_name to interval functions to avoid ambiguity

* Filter coupon store by default order statuses

* Fix interval stats by adding table_name to interval function

* Filter products store by default order statuses

* Remove unused order_status in coupons data store

* Store products with any order status

* Fix ambiguous order by call in products data store

* Apply status filter after other filters to avoid logical OR matching

* Store all coupon data regardless of order status

* Filter taxes by default order statuses

* Filter customer stats by default order status

* Filter default order statuses in variations data store

* Use excluded statuses to filter reports by default

* DRY up default excluded statuses query

* Fix up new orders data store after rebase
2019-01-16 10:23:00 +08:00
Jeff Stieler 06763cc3a5 Don’t cast date values to strings in customers report data store since they’re allowed to be null.
NULL column values resulted in NOW() in the response.
2019-01-08 18:49:49 -07:00
Jeff Stieler d9fd8568df Customers report: perform a LEFT JOIN on the order stats table to include customers that have not yet placed an order. 2019-01-08 10:47:19 -07:00
Jeff Stieler 46b503dd54 Update customers report lookup table when customers/users are updated. 2019-01-08 10:33:17 -07:00
Jeff Stieler 154482acc9 Derive orders_count, total_spend, avg_order_value, and date_late_order for customer reports from the order stats report table. 2019-01-08 10:33:17 -07:00
Jeff Stieler 8105ddb38a Add new guest customers to lookup when syncing the order stats report table. 2019-01-08 10:33:16 -07:00
Jeff Stieler d42e04cd59 Short circuit registered customer data update when the given ID is bad. 2019-01-08 10:29:44 -07:00
Jeff Stieler c337944cf6 Backfill guests into customer report lookup table using order data and billing email. 2019-01-08 10:29:43 -07:00
Jeff Stieler fa3379e62f Customer report data store: fix handling of ‘name’ parameter in WHERE clause. 2019-01-08 10:29:42 -07:00
Jeff Stieler 714c1ee030 Customer report data store: fix comparison operator for date param “after” where clause. 2019-01-08 10:29:42 -07:00
Jeff Stieler 04a30e668b Customer report data store: fix SQL when where clauses are empty. 2019-01-08 10:29:40 -07:00
Jeff Stieler 1832450fd1 Update customer lookup table when orders (with registered customers) are created, updated, or refunded. 2019-01-08 10:29:40 -07:00
Jeff Stieler 2ea61e9a86 Move registered customer lookup update logic into data store class. 2019-01-08 10:29:40 -07:00
Jeff Stieler fc20d2bb1b Remove unnecessary subquery from customer reports data store records count query. 2019-01-08 10:29:38 -07:00
Jeff Stieler a75a33c32f Handle match parameter in customers report data store.
Note: before/after and min/max ranges are always ‘AND’.
2019-01-08 10:29:38 -07:00
Jeff Stieler 9670719fc6 Add customers report query endpoint implementation. 2019-01-08 10:29:36 -07:00