Commit Graph

228 Commits

Author SHA1 Message Date
Jeff Stieler ddae6d3955 Add currency symbol to orders endpoint response. 2019-01-17 00:01:09 -07:00
Jeff Stieler 149ee08f4b Include all users in customer lookup table generation. 2019-01-16 10:20:11 -07:00
Jeff Stieler 11cb74cccd Fix variable name nitpick. 2019-01-16 09:45:52 -07:00
Jeff Stieler a2f94c11ba Add coupons and taxes lookup table generation to reports rebuild. 2019-01-16 09:45:51 -07:00
Jeff Stieler 84732137bc Bail out of creating batches for customers and orders if there are none. 2019-01-16 09:45:51 -07:00
Jeff Stieler ffe11650a8 Remove now-defunct order stats background process. 2019-01-16 09:45:50 -07:00
Jeff Stieler 763cc972a7 Regenerate all reports from rebuild stats endpoint. 2019-01-16 09:45:04 -07:00
Jeff Stieler 5c6174066e Add tests for report regeneration batch queuing methods. 2019-01-16 09:45:04 -07:00
Jeff Stieler 4786938bdf Fix customers report tests. 2019-01-16 09:45:03 -07:00
Jeff Stieler 6eca20c5fd Reports regenerate: add mechanism to queue an action after another completes - use to queue orders lookup init after customers lookup. 2019-01-16 09:45:03 -07:00
Jeff Stieler 4740f93985 Reports regenerate: use queue to update order stats and products lookup table. 2019-01-16 09:45:02 -07:00
Jeff Stieler 3b9a4ef4a1 Report regeneration: allow batch sizes to differ between actions. 2019-01-16 09:45:02 -07:00
Jeff Stieler fabc1dc70b Reports regenerate: use queue to update customers lookup table. 2019-01-16 09:45:02 -07:00
Jeff Stieler c361119a0d Report table generation: add method for enqueuing a large number of batch jobs with a limited batch size. 2019-01-16 09:45:01 -07: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
Joshua T Flowers 14f8f08edf Add v4 orders endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1246)
* Rename orders controllers and data store to order stats

* Add orders data store and controller

* Add coupon, product, and status filters

* Add customer type query filter

* Add extended info for products and categories

* Bump API namespace to v4

* Add missing schema properties

* Set default customer_type and extended_info params

* Add orders endpoint tests

* Only use one JOIN if both excluded and included queries are used

* Optimize query calls to get product and category data

* Split product and category fetch and limit to product_cat taxonomy
2019-01-15 09:53:02 +08:00
Jeff Stieler adf8bbeb23 Merge pull request woocommerce/woocommerce-admin#1260 from woocommerce/fix/1239-handle-between-rest-api-param
Handle *_between params in Reports controllers
2019-01-10 10:52:08 -07:00
Justin Shreve 350e296d2c Allow sorting by title and SKU to report tables (https://github.com/woocommerce/woocommerce-admin/pull/1266) 2019-01-10 12:10:31 -05:00
Jeff Stieler 2246a1e075 Expect array value for _between params.
Add param validation method and normalize to min/max based by comparing values.
2019-01-09 14:19:37 -07:00
Justin Shreve d46ce1df7a Add store performance indicator endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1255)
* Add store performance REST API endpoint

* Clean up validation, add list of allowed stats to OPTIONS endpoint, and rename endpoint to performance-indicators

* Add tests

* Add additional filters to make extending the performance indiciators area easier.

* Add docblocks for filters
2019-01-09 16:08:39 -05: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 6e369bd145 Handle *_between parameters in Customers Report endpoint controller. 2019-01-08 17:41:48 -07:00
Jeff Stieler b15a4bc804 Add utility method to normalize numeric “between” parameters in REST API requests. 2019-01-08 17:41:24 -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 1a90840e97 Add customer_id to order stats report table to reference with customer lookup. 2019-01-08 10:30: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 a1317f2152 Customer lookup table: allow registration date to be null (for guests). 2019-01-08 10:29:43 -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 737331dd3b Add missing _gmt date fields to customers report response items. 2019-01-08 10:29:41 -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 d0e2c5162f Place a UNIQUE constraint on the user_id key for the customer report lookup table. 2019-01-08 10:29:39 -07:00
Jeff Stieler dd87522a5e Customers report endpoint: only include customer link if they’re a registered user. 2019-01-08 10:29:39 -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 97e6f795e9 Fix copy-pasta in customers report REST controller. 2019-01-08 10:29:38 -07:00
Jeff Stieler a180566c2f Set default parameters for customers report query. 2019-01-08 10:29:37 -07:00
Jeff Stieler 0c919add5d Fix query params in customers report controller. 2019-01-08 10:29:37 -07:00
Jeff Stieler 6e5fef2f7b Include customers report files. 2019-01-08 10:29:37 -07:00
Jeff Stieler 746120e254 Change customer report lookup table columns to match API parameters. 2019-01-08 10:29:36 -07:00
Jeff Stieler 9670719fc6 Add customers report query endpoint implementation. 2019-01-08 10:29:36 -07:00
Jeff Stieler b9f0d9fe5f Update customers report endpoint item schema to match (visual) table designs. 2019-01-08 10:29:35 -07:00
Jeff Stieler 56beada220 Update customers report endpoint parameters to match new lookup table filters. 2019-01-08 10:29:35 -07:00
Jeff Stieler a2154daa4c Register customer report lookup table with core WC. 2019-01-08 10:29:35 -07:00