{"action":"created","issue":{"url":"https://api.github.com/repos/alphasights/lion-api/issues/29","labels_url":"https://api.github.com/repos/alphasights/lion-api/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/alphasights/lion-api/issues/29/comments","events_url":"https://api.github.com/repos/alphasights/lion-api/issues/29/events","html_url":"https://github.com/alphasights/lion-api/pull/29","id":128608221,"number":29,"title":"Refactor /api/stats endpoint to receive category parameter","user":{"login":"delkopiso","id":5182637,"avatar_url":"https://avatars.githubusercontent.com/u/5182637?v=3","gravatar_id":"","url":"https://api.github.com/users/delkopiso","html_url":"https://github.com/delkopiso","followers_url":"https://api.github.com/users/delkopiso/followers","following_url":"https://api.github.com/users/delkopiso/following{/other_user}","gists_url":"https://api.github.com/users/delkopiso/gists{/gist_id}","starred_url":"https://api.github.com/users/delkopiso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delkopiso/subscriptions","organizations_url":"https://api.github.com/users/delkopiso/orgs","repos_url":"https://api.github.com/users/delkopiso/repos","events_url":"https://api.github.com/users/delkopiso/events{/privacy}","received_events_url":"https://api.github.com/users/delkopiso/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-25T18:42:31Z","updated_at":"2016-01-25T23:04:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphasights/lion-api/pulls/29","html_url":"https://github.com/alphasights/lion-api/pull/29","diff_url":"https://github.com/alphasights/lion-api/pull/29.diff","patch_url":"https://github.com/alphasights/lion-api/pull/29.patch"},"body":"# What's up\r\nCurrently, the `/api/stats` endpoint returns all stats under encapsulated in a user object and the payload looks thus:\r\n\r\n```json\r\nstats: [\r\n  {\r\n    \"id\": \"1\",\r\n    \"avatar_url\": \"http://www.example.org/picture1.jpg\",\r\n    \"nickname\": \"octocat1\",\r\n    \"pullRequestCount\": 112,\r\n    \"pullRequestReviewsCount\": 5,\r\n    \"additionsCount\": 1223,\r\n    \"deletionsCount\": 2342,\r\n    \"badgesCount\": 3\r\n  },\r\n  {\r\n    \"id\": \"2\",\r\n    \"avatar_url\": \"http://www.example.org/picture2.jpg\",\r\n    \"nickname\": \"octocat2\",\r\n    \"pullRequestCount\": 467,\r\n    \"pullRequestReviewsCount\": 122,\r\n    \"additionsCount\": 51223,\r\n    \"deletionsCount\": 24342,\r\n    \"badgesCount\": 23\r\n  },\r\n  ...\r\n]\r\n```\r\n\r\nWe would prefer to have the endpoint respond dynamically to the request `/api/stats/badges` with the corresponding payload:\r\n\r\n```json\r\nstats: [\r\n  {\r\n    \"id\": \"1\",\r\n    \"avatar_url\": \"http://www.example.org/picture1.jpg\",\r\n    \"nickname\": \"octocat1\",\r\n    \"count\": 3\r\n  },\r\n  {\r\n    \"id\": \"2\",\r\n    \"avatar_url\": \"http://www.example.org/picture2.jpg\",\r\n    \"nickname\": \"octocat2\",\r\n    \"count\": 23\r\n  },\r\n  ...\r\n]\r\n```\r\n\r\n# What this does\r\n- Refactors `Api::StatsController` to query the database based on the value in the `category` parameter.\r\n- Refactors `StatsSerializer` to no longer inherit from `UserSerializer`."},"comment":{"url":"https://api.github.com/repos/alphasights/lion-api/issues/comments/174719126","html_url":"https://github.com/alphasights/lion-api/pull/29#issuecomment-174719126","issue_url":"https://api.github.com/repos/alphasights/lion-api/issues/29","id":174719126,"user":{"login":"farisj","id":7132760,"avatar_url":"https://avatars.githubusercontent.com/u/7132760?v=3","gravatar_id":"","url":"https://api.github.com/users/farisj","html_url":"https://github.com/farisj","followers_url":"https://api.github.com/users/farisj/followers","following_url":"https://api.github.com/users/farisj/following{/other_user}","gists_url":"https://api.github.com/users/farisj/gists{/gist_id}","starred_url":"https://api.github.com/users/farisj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farisj/subscriptions","organizations_url":"https://api.github.com/users/farisj/orgs","repos_url":"https://api.github.com/users/farisj/repos","events_url":"https://api.github.com/users/farisj/events{/privacy}","received_events_url":"https://api.github.com/users/farisj/received_events","type":"User","site_admin":false},"created_at":"2016-01-25T23:04:26Z","updated_at":"2016-01-25T23:04:26Z","body":":+1: when tests pass"}}