{"action":"created","issue":{"url":"https://api.github.com/repos/woocommerce/wc-admin/issues/316","repository_url":"https://api.github.com/repos/woocommerce/wc-admin","labels_url":"https://api.github.com/repos/woocommerce/wc-admin/issues/316/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/wc-admin/issues/316/comments","events_url":"https://api.github.com/repos/woocommerce/wc-admin/issues/316/events","html_url":"https://github.com/woocommerce/wc-admin/pull/316","id":353054914,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMjEwODE0","number":316,"title":"Connect the revenue report to the API","user":{"login":"justinshreve","id":689165,"node_id":"MDQ6VXNlcjY4OTE2NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/689165?v=4","gravatar_id":"","url":"https://api.github.com/users/justinshreve","html_url":"https://github.com/justinshreve","followers_url":"https://api.github.com/users/justinshreve/followers","following_url":"https://api.github.com/users/justinshreve/following{/other_user}","gists_url":"https://api.github.com/users/justinshreve/gists{/gist_id}","starred_url":"https://api.github.com/users/justinshreve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinshreve/subscriptions","organizations_url":"https://api.github.com/users/justinshreve/orgs","repos_url":"https://api.github.com/users/justinshreve/repos","events_url":"https://api.github.com/users/justinshreve/events{/privacy}","received_events_url":"https://api.github.com/users/justinshreve/received_events","type":"User","site_admin":false},"labels":[{"id":921901163,"node_id":"MDU6TGFiZWw5MjE5MDExNjM=","url":"https://api.github.com/repos/woocommerce/wc-admin/labels/Analytics","name":"Analytics","color":"80f7d3","default":false},{"id":921782814,"node_id":"MDU6TGFiZWw5MjE3ODI4MTQ=","url":"https://api.github.com/repos/woocommerce/wc-admin/labels/[Status]%20Needs%20Review","name":"[Status] Needs Review","color":"fbca04","default":false},{"id":921891130,"node_id":"MDU6TGFiZWw5MjE4OTExMzA=","url":"https://api.github.com/repos/woocommerce/wc-admin/labels/[Tests]%20Includes%20Tests","name":"[Tests] Includes Tests","color":"5ae8a3","default":false}],"state":"open","locked":false,"assignee":{"login":"justinshreve","id":689165,"node_id":"MDQ6VXNlcjY4OTE2NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/689165?v=4","gravatar_id":"","url":"https://api.github.com/users/justinshreve","html_url":"https://github.com/justinshreve","followers_url":"https://api.github.com/users/justinshreve/followers","following_url":"https://api.github.com/users/justinshreve/following{/other_user}","gists_url":"https://api.github.com/users/justinshreve/gists{/gist_id}","starred_url":"https://api.github.com/users/justinshreve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinshreve/subscriptions","organizations_url":"https://api.github.com/users/justinshreve/orgs","repos_url":"https://api.github.com/users/justinshreve/repos","events_url":"https://api.github.com/users/justinshreve/events{/privacy}","received_events_url":"https://api.github.com/users/justinshreve/received_events","type":"User","site_admin":false},"assignees":[{"login":"justinshreve","id":689165,"node_id":"MDQ6VXNlcjY4OTE2NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/689165?v=4","gravatar_id":"","url":"https://api.github.com/users/justinshreve","html_url":"https://github.com/justinshreve","followers_url":"https://api.github.com/users/justinshreve/followers","following_url":"https://api.github.com/users/justinshreve/following{/other_user}","gists_url":"https://api.github.com/users/justinshreve/gists{/gist_id}","starred_url":"https://api.github.com/users/justinshreve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinshreve/subscriptions","organizations_url":"https://api.github.com/users/justinshreve/orgs","repos_url":"https://api.github.com/users/justinshreve/repos","events_url":"https://api.github.com/users/justinshreve/events{/privacy}","received_events_url":"https://api.github.com/users/justinshreve/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-08-22T17:39:31Z","updated_at":"2018-08-27T09:01:36Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/woocommerce/wc-admin/pulls/316","html_url":"https://github.com/woocommerce/wc-admin/pull/316","diff_url":"https://github.com/woocommerce/wc-admin/pull/316.diff","patch_url":"https://github.com/woocommerce/wc-admin/pull/316.patch"},"body":"This PR is the first step in properly connecting the revenue report up to the API.\r\n\r\nThe report is not 100% done. Here are a few notes/todos/issues.\r\n\r\n* Zero-filled data. After the meeting today, we decided this will be done server side. In in the meantime, if you have gap days, they will not show up on the report. That means some report filters might return an 'empty' response (i.e. if you have 'today' selected with no orders) right now. This can also cause an issue with the 'Previous Period' total on the chart (see screenshot below), because we pull out the matching secondary data point based on the primary dates, and if some are missing from the response, the secondary points don't get added to the chart.\r\n* Different intervals. Right now, you can only view data points as days. More handling needs to be written to support other intervals (hours, weeks, etc).\r\n* No loading indicators or empty state. I have some super temporary unstyled messages implemented at the moment. We still need a full page loading indicator and a message for empty/error states. See #302.\r\n* The data points seem to be off by one day (i.e. the axis shows 29, but if you hover over the point it is for the 30th). This seems to be happening on the hardcoded dashboard example as well. I will log an issue. cc @greenafrican \r\n* The utilities and code I've written for this report should be useable in other reports. I've left the code in revenue for now while trying to figure everything out, but I expect this code to be moved out so it can be reused by other reports.\r\n\r\nOtherwise, you are able to filter the report by date, paginate and sort the table, and view summary numbers.\r\n\r\nA note on the API requests: For requests that have results over multiple API pages (i.e. you are viewing a large date span with over 100 results), we need to make requests for all pages so we can properly fill out the graph. I created a utility to help with this.\r\n\r\n<img width=\"1090\" alt=\"screen shot 2018-08-22 at 1 16 33 pm\" src=\"https://user-images.githubusercontent.com/689165/44479154-bd914500-a60d-11e8-9cc8-f8c1a8dcdc2c.png\">\r\n\r\n<img width=\"1074\" alt=\"screen shot 2018-08-22 at 1 17 12 pm\" src=\"https://user-images.githubusercontent.com/689165/44479181-d863b980-a60d-11e8-8ff2-efa24fc5d253.png\">\r\n\r\nTo Test:\r\n* run `npm test` and make sure all tests pass\r\n* Before testing on your site, you may want to generate a number of orders. You can use [wc-smooth-generator](https://github.com/woocommerce/wc-smooth-generator) to do this. See the [README](https://github.com/woocommerce/wc-smooth-generator/blob/master/README.md#orders) for an example.\r\n* Pull the latest WooCommerce v3 API from `feature/rest-api-v3-reports` (you might need to deactivate `wc-api-dev`).\r\n* You need to deactivate and reactivate WooCommerce to get the correct summary MySQL tables. There is also a tool under system settings to rebuild the summary tables.\r\n* Visit the revenue report.\r\n* Test reordering columns, paging results, etc."},"comment":{"url":"https://api.github.com/repos/woocommerce/wc-admin/issues/comments/416162870","html_url":"https://github.com/woocommerce/wc-admin/pull/316#issuecomment-416162870","issue_url":"https://api.github.com/repos/woocommerce/wc-admin/issues/316","id":416162870,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjE2Mjg3MA==","user":{"login":"peterfabian","id":2207451,"node_id":"MDQ6VXNlcjIyMDc0NTE=","avatar_url":"https://avatars2.githubusercontent.com/u/2207451?v=4","gravatar_id":"","url":"https://api.github.com/users/peterfabian","html_url":"https://github.com/peterfabian","followers_url":"https://api.github.com/users/peterfabian/followers","following_url":"https://api.github.com/users/peterfabian/following{/other_user}","gists_url":"https://api.github.com/users/peterfabian/gists{/gist_id}","starred_url":"https://api.github.com/users/peterfabian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterfabian/subscriptions","organizations_url":"https://api.github.com/users/peterfabian/orgs","repos_url":"https://api.github.com/users/peterfabian/repos","events_url":"https://api.github.com/users/peterfabian/events{/privacy}","received_events_url":"https://api.github.com/users/peterfabian/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T09:01:36Z","updated_at":"2018-08-27T09:01:36Z","author_association":"NONE","body":"@timmyc Tried on a clean install of WP & WC 3.4.4, created 2 products and 2 order manually, then added 20 products and 100 orders using smooth generator, checked out `feature/rest-api-v3-reports`, reactivated the plugin, clicked on `Rebuild reports` and it generated the data into the db table `wp_wc_order_stats` and then `wc/v3/reports/revenue/stats/` worked ok.\r\n\r\nBased on the error you reported, it seems like there are basically 2 possible explanations: \r\n- result from db being invalid \r\n- page requested is < 1 or > total number of pages\r\n\r\nMaybe you can check how the table `wp_wc_order_stats` looks in your installation--is there any data in there? Any errors in the logs that might relate to generating data for it? "}}
{"actor":{"display_login":"peterfabian"}}