Commit Graph

116 Commits

Author SHA1 Message Date
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
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 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
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
Joshua T Flowers f3346e9298 Add the order status column to lookup table (https://github.com/woocommerce/woocommerce-admin/pull/1211)
* Add the order status column to lookup table

* Fix order status filter for order stats

* Fix normalize order status and make static function
2019-01-08 09:16:10 +08:00
Albert Juhé Lluveras 6ca0c628b2 Connect Downloads report to REST API (https://github.com/woocommerce/woocommerce-admin/pull/1238)
* Connect downloads chart and table to REST API

* Display date picker in Downloads report

* Fix missing value for 'days' in Downloads table summary

* Fix download_count being a string instead of a number

* Minor date packages comment fixes

* Fix filters in Downloads report

* Add back empty line

* JSDoc comments style fixes

* Fix username filter not working

* Fix days counter off by 1

* Fix alignment issue
2019-01-07 12:54:42 +01: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 3f388028ac Sort default category response by category ID (https://github.com/woocommerce/woocommerce-admin/pull/1201) 2018-12-28 09:50:58 -08:00
Joshua T Flowers b3979ff984 Fix order status product sync (https://github.com/woocommerce/woocommerce-admin/pull/1151)
* Move order product sync to product data store

* Move order taxes sync to taxes data store

* Move order coupons sync to coupons data store

* Use table_name constant in data syncs

* Remove order data for incomplete order statuses

* Fix report rebuild tool

* Update comments to describe create/update entry reference

* Fix data_store_init function name change
2018-12-27 11:49:00 +08:00
Joshua T Flowers 987929da83 Filter by categories query param in categories data store (https://github.com/woocommerce/woocommerce-admin/pull/1179) 2018-12-27 11:31:08 +08:00
Joshua T Flowers 017db0b339 Sync order status on refund delete (https://github.com/woocommerce/woocommerce-admin/pull/1074) 2018-12-27 11:11:33 +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 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
Paul Sealock 46c313cdc7 REST API: Categories: optimize query by removing get_the_terms 2018-12-21 11:08:08 +13: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
Paul Sealock 15bbbe739d Hook up Categories table to endpoint 2018-12-19 08:36:42 +13:00
Peter Fabian 85e6e8df8d Added correct cache handling. 2018-12-18 12:01:42 +08:00
Peter Fabian 6c456657e8 Changed coupon_gross_discount to amount. 2018-12-18 12:01:42 +08:00
Peter Fabian 21ac75d21e Made extended_info always appear in coupons endpoint. 2018-12-18 12:01:40 +08:00
Peter Fabian 3e45c6a82c Fixed invalid sort criterion for coupons endpoint. 2018-12-18 12:01:39 +08:00
Peter Fabian a346f13beb Added extended info. 2018-12-18 12:01:38 +08:00
Peter Fabian 5eee869a74 Added small fixes to set up coupon endpoints. 2018-12-18 12:01:38 +08:00
Peter Fabian 357b8f914a Added query classes and data stores for coupons and coupons/stats. 2018-12-18 12:01:17 +08:00
Peter Fabian e273d055ef Moved functions from orders data store to allow code reuse. 2018-12-18 12:00:33 +08:00
Joshua T Flowers 9486ab7896 Update/taxes endpoint hookup/941 (https://github.com/woocommerce/woocommerce-admin/pull/1008)
* Hook up taxes to endpoint

* Hook up tax stats endpoint

* Add default tax stat totals for empty results

* Create subtotals from intervals in API

* Change orders to orders_count to keep consistent naming
2018-12-18 10:26:46 +08:00
Allen Snook de105648be Activity Panel: Inbox: Filter update and error notes out of the inbox (https://github.com/woocommerce/woocommerce-admin/pull/893)
* Filter update and error notes out of the inbox

* Remove redundant trim().

* Fix test for admin notes API type parameter.
2018-12-11 09:00:57 +08:00
Joshua T Flowers 04d3ce6eb1 Add taxes endpoint and data store (https://github.com/woocommerce/woocommerce-admin/pull/1000)
* Add taxes endpoint and data store

* Add sorting options and normalize orderby param

* Add report taxes unit tests

* Add tax rate to response

* Add country, state, priority, and name to response

* Fix tax codes query param

* Add class comment

* Add missing  to record query

* Add comment about ambiguous column
2018-12-11 08:58:05 +08:00
Joshua T Flowers 557cec57cb Add tax stats endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1019) 2018-12-11 08:55:05 +08:00
Paul Sealock 93a7472e54 REST API: Add stock info to products and variations 2018-12-11 07:19:46 +13:00
Joshua T Flowers 5d3c771d45 Trigger sync_order on order stats table when refunding (https://github.com/woocommerce/woocommerce-admin/pull/990) 2018-12-05 10:10:22 +08:00
Joshua T Flowers 755b9c94f7 Reduce order table net revenue by refund total (https://github.com/woocommerce/woocommerce-admin/pull/988)
* Reduce order table net revenue by refund total

* Use order utils to get refund total
2018-12-05 10:06:00 +08:00