Commit Graph

117 Commits

Author SHA1 Message Date
Paul Sealock 4854933485 Merge pull request woocommerce/woocommerce-admin#1404 from woocommerce/fix/customers-date-between-args
Customers Report: REST API: Fix between argument handling
2019-01-30 10:32:54 +13:00
Timmy Crawford 10c6016d4c Update usage of lib/number to @woocommerce/number (https://github.com/woocommerce/woocommerce-admin/pull/1400)
* Remove usage of lib/number

* Remove formatNumber usage when currency is used.

* Add wc-number as a dependency of wc-currency.

* Add locutus as a dev dependency.

* Add number to test helper.
2019-01-29 08:48:46 -08:00
Paul Sealock 3e16a37be0 add tests 2019-01-29 11:01:25 +13:00
Paul Sealock 483c199fbf tests working 2019-01-29 10:53:56 +13:00
Paul Sealock 2f022ffdba dry interval.php 2019-01-29 10:23:44 +13:00
Paul Sealock 3d0890a704 basic working 2019-01-29 09:21:11 +13:00
Paul Sealock bca0785e64 Customers Report: support between args for dates 2019-01-29 08:58:07 +13:00
Jeff Stieler 7592dae4bb Merge pull request woocommerce/woocommerce-admin#1385 from woocommerce/add/customers-report-table-summary
Add table summary to Customers Report
2019-01-28 09:59:52 -07:00
Jeff Stieler 2703a0da4c Merge pull request woocommerce/woocommerce-admin#1370 from woocommerce/fix/942-phpunit-gutenberg-dependency
Conditionally include Gutenberg plugin in test suite
2019-01-28 09:59:13 -07:00
Jeff Stieler 8207bd7649 Add tests for customers report stats endpoint. 2019-01-23 17:48:22 -07:00
Jeff Stieler 4cfa082d0f Load gutenberg from test plugins directory if required. 2019-01-23 16:59:10 -07:00
Peter Fabian d61a4dd5bd Updated tests to be more stable around hour end. 2019-01-25 00:06:59 +01:00
Jeff Stieler 2d4aea1971 Only install/activate Gutenberg plugin if WP version under test is earlier than 5.0. 2019-01-22 10:44:00 -07:00
Peter Fabian 8a9a2c0673 Fixed interval arithmetic for hours and days. 2019-01-22 17:49:02 +01:00
Justin Shreve 1f8caf106e Fix performance-indicators/allowed schema. 2019-01-21 12:28:32 -05:00
Justin Shreve 01b96ebea5 Hook up performance indicators to the REST API 2019-01-18 08:19:19 -05:00
Justin Shreve 96fc10747f Add label and generated report URL to the performance indicator response. 2019-01-18 08:16:52 -05:00
Joshua T Flowers 7cdbbf87e8 Update all wc-admin endpoints to v4 (https://github.com/woocommerce/woocommerce-admin/pull/1298)
* Update all wc-admin endpoints to v4

* Add namespace for products and customers controllers

* Include product quantity in orders data store

* Add coupons to extended data in the orders data store

* Format order statuses response from database

* Hook up orders table to orders endpoint

* Add namespace to data endpoint controller

* Add namespaces to remaining extended controllers

* Use NAMESPACE var in place of wc/v4

* Update product links in orders table to products reports

* Add coupons rest controller override

* Format coupon code in response

Co-Authored-By: joshuatf <joshuatf@gmail.com>
2019-01-18 10:52:58 +08:00
Jeff Stieler 4407e05bc4 Merge pull request woocommerce/woocommerce-admin#1342 from woocommerce/fix/1090-currency-settings-formatting
Honor WooCommerce Settings When Formatting Currency/Price
2019-01-17 17:06:13 -07:00
Jeff Stieler 6ed8ea117a Refactor formatCurrency() to use store settings for formatting rather than store locale. 2019-01-17 00:04:57 -07:00
Joshua T Flowers da22cbdc9d Update returning customer data to use customer ID (https://github.com/woocommerce/woocommerce-admin/pull/1180)
* Change check for returning customers to check customer_id

* Count distinct returning and new customers in totals

* Fix priority action misplacement and order date timestamp

* Change expected num returning/new customers to fix failing tests

Previously these included references to number of returning vs new orders.  Update to refer to the newly updated customer count.

* Use new get_customer_id_by_user_id() to get customer ID

* Fix 0 returning customers expectation

* Move returning customer function to order stats data store

* Sync order stats on order delete

* Change date compare for is_returning_customer

* Add test case for returning customer order

* Add references to  instead of 2
2019-01-17 10:47:30 +08:00
Jeff Stieler c0e6a097fd Fix orders report test. 2019-01-16 09:45:52 -07:00
Jeff Stieler 5c6174066e Add tests for report regeneration batch queuing methods. 2019-01-16 09:45:04 -07:00
Jeff Stieler 1a5af7094d Add WC_Action_Queue test helper class.
The test helper allows inspection of the action queue.
2019-01-16 09:45:04 -07:00
Jeff Stieler 4786938bdf Fix customers report tests. 2019-01-16 09:45:03 -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
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 b15a4bc804 Add utility method to normalize numeric “between” parameters in REST API requests. 2019-01-08 17:41:24 -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 d000d3e42a Add cases using ‘name’ and a date parameter to customers report endpoint tests. 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 1a4b890660 Add unit tests for customers report endpoint. 2019-01-08 10:29:41 -07:00
Justin Shreve f37b9319e1 Download Report API: Add path to response, fix ordering, and fix schema typo (https://github.com/woocommerce/woocommerce-admin/pull/1248)
* Add download_path to download report endpoint and fix schema typo

* Fix ordering and add tests
2019-01-08 09:51:28 -05:00
Justin Shreve e3e9ccb6a4 Add `reports/downloads/stats` REST API Endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1142)
* First pass at downloads REST API

* Add reports/downloads/stats endpoint.

* Add tests

* Update cache key
2019-01-03 13:00:48 -05:00
Joshua T Flowers 7bbdd78bde Add missing intervals to product reports (https://github.com/woocommerce/woocommerce-admin/pull/1200)
* Add missing intervals to product reports

* Fix failing tests for product stats API

Before and after query should be within today's date since missing intervals for other days will be filled in with remaining dates.
2018-12-31 13:20:22 +08:00
Joshua T Flowers 268182e75f Add invalid note ID test (https://github.com/woocommerce/woocommerce-admin/pull/1197) 2018-12-28 09:44:53 -08:00
Peter Fabian 48dfb54a48 Switched average order value from gross to net revenue (https://github.com/woocommerce/woocommerce-admin/pull/1158)
* Switched Average order value calculation from gross to net revenue.

* Updated tests to reflect switch of average order value from gross to net revenue.
2018-12-26 15:49:46 -08:00
Joshua T Flowers dcaa35c7bf Add product SKU to products report (https://github.com/woocommerce/woocommerce-admin/pull/1161)
* Add product SKU to products report

* Add tests for SKU data
2018-12-25 11:02:06 +08:00
Justin Shreve 579113910d Add remaining filters to the downloads report (https://github.com/woocommerce/woocommerce-admin/pull/1141)
* Add order number, username, and IP address filters to the downloads report.

* Adds tests
2018-12-21 16:40:41 -08:00
Justin Shreve 49a0f0f6d2 Add `reports/downloads` REST API endpoint. (https://github.com/woocommerce/woocommerce-admin/pull/1122)
* First pass at downloads REST API

* Handle PR feedback
2018-12-21 14:57:46 -08:00
Joshua T Flowers f83b0e0615 Add product categories wc-api and breadcrumbs (https://github.com/woocommerce/woocommerce-admin/pull/1131)
* Add support for product cats in wp rest api

* Add categories to WC API

* Add category breadcrumbs component

* Increase per_page limit size for product cat API

* Use wc/v3 API to pull product categories

* Return category IDs in API

* Add categories to product reports

* Add category IDs test for REST API

* Switch to getResource instead of require for total count selector
2018-12-21 10:44:27 +08:00
Peter Fabian dff8b63271 Merge pull request woocommerce/woocommerce-admin#1010 from woocommerce/fix/845
Added /reports/coupons and /reports/coupons/stats endpoints
2018-12-19 13:55:28 +01:00
Peter Fabian 4802736a0e Switched from using coupon code filter to coupon id filter by query parameter. 2018-12-19 13:37:54 +01:00
Joshua T Flowers 08d3e2c38d Change product_gross_revenue to product_net_revenue (https://github.com/woocommerce/woocommerce-admin/pull/1105)
* Change product_gross_revenue to product_net_revenue

* Change product_gross_revenue to product_net_revenue in category data store

* Change to net_revenue in frontend category report
2018-12-19 08:56:27 +08:00
Jeff Stieler 9581a658f5 Add expected locale settings to JS test setup. 2018-12-18 15:46:46 -07:00
Paul Sealock 15bbbe739d Hook up Categories table to endpoint 2018-12-19 08:36:42 +13:00
Peter Fabian 6c456657e8 Changed coupon_gross_discount to amount. 2018-12-18 12:01:42 +08:00