{"action":"opened","number":70,"pull_request":{"url":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/70","id":54619021,"html_url":"https://github.com/teamendgame/endgame-chess/pull/70","diff_url":"https://github.com/teamendgame/endgame-chess/pull/70.diff","patch_url":"https://github.com/teamendgame/endgame-chess/pull/70.patch","issue_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues/70","number":70,"state":"open","locked":false,"title":"Show User Score (User Dashboard)","user":{"login":"jonathanpike","id":8129357,"avatar_url":"https://avatars.githubusercontent.com/u/8129357?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanpike","html_url":"https://github.com/jonathanpike","followers_url":"https://api.github.com/users/jonathanpike/followers","following_url":"https://api.github.com/users/jonathanpike/following{/other_user}","gists_url":"https://api.github.com/users/jonathanpike/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanpike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanpike/subscriptions","organizations_url":"https://api.github.com/users/jonathanpike/orgs","repos_url":"https://api.github.com/users/jonathanpike/repos","events_url":"https://api.github.com/users/jonathanpike/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanpike/received_events","type":"User","site_admin":false},"body":"This PR deals with showing the user's score.  A couple of things: \r\n\r\n1. I created a users controller along with a user show page.  @ronny2205 can use this for the user dashboard.  \r\n\r\n2. In the users controller, I've created 4 helper methods that deal with calculating the score.  There was a bug with rubocop as to how I was calculating the scores.  What my code does is query the database once and store the ActiveRecord::Relation in the `@games` instance variable.  Then, the helper methods filter the ActiveRecord::Relation to give you the counts of wins, losses, and draws.  It seems rubocop doesn't like how I used `select...count`, but it's a bug.  You can view the issue [here](https://github.com/bbatsov/rubocop/issues/1868). \r\n\r\n3. I updated our routes to only have routes for `pieces` and `users` where we need them (ie. we only use the pieces update and the users show actions, so I've limited the routes to those actions). \r\n\r\n4. I made a really neat looking scorecard on the users show page: \r\n\r\n![screen shot 2015-12-27 at 9 59 44 am](https://cloud.githubusercontent.com/assets/8129357/12010789/b3ddd29e-ac82-11e5-9977-3cb2244d145c.png)","created_at":"2015-12-27T15:16:28Z","updated_at":"2015-12-27T15:16:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/70/commits","review_comments_url":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/70/comments","review_comment_url":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/comments{/number}","comments_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues/70/comments","statuses_url":"https://api.github.com/repos/teamendgame/endgame-chess/statuses/bef8fac5cf9718d772373e50d0dd111233f63d57","head":{"label":"teamendgame:user_score","ref":"user_score","sha":"bef8fac5cf9718d772373e50d0dd111233f63d57","user":{"login":"teamendgame","id":15490891,"avatar_url":"https://avatars.githubusercontent.com/u/15490891?v=3","gravatar_id":"","url":"https://api.github.com/users/teamendgame","html_url":"https://github.com/teamendgame","followers_url":"https://api.github.com/users/teamendgame/followers","following_url":"https://api.github.com/users/teamendgame/following{/other_user}","gists_url":"https://api.github.com/users/teamendgame/gists{/gist_id}","starred_url":"https://api.github.com/users/teamendgame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamendgame/subscriptions","organizations_url":"https://api.github.com/users/teamendgame/orgs","repos_url":"https://api.github.com/users/teamendgame/repos","events_url":"https://api.github.com/users/teamendgame/events{/privacy}","received_events_url":"https://api.github.com/users/teamendgame/received_events","type":"Organization","site_admin":false},"repo":{"id":45283424,"name":"endgame-chess","full_name":"teamendgame/endgame-chess","owner":{"login":"teamendgame","id":15490891,"avatar_url":"https://avatars.githubusercontent.com/u/15490891?v=3","gravatar_id":"","url":"https://api.github.com/users/teamendgame","html_url":"https://github.com/teamendgame","followers_url":"https://api.github.com/users/teamendgame/followers","following_url":"https://api.github.com/users/teamendgame/following{/other_user}","gists_url":"https://api.github.com/users/teamendgame/gists{/gist_id}","starred_url":"https://api.github.com/users/teamendgame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamendgame/subscriptions","organizations_url":"https://api.github.com/users/teamendgame/orgs","repos_url":"https://api.github.com/users/teamendgame/repos","events_url":"https://api.github.com/users/teamendgame/events{/privacy}","received_events_url":"https://api.github.com/users/teamendgame/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/teamendgame/endgame-chess","description":"","fork":false,"url":"https://api.github.com/repos/teamendgame/endgame-chess","forks_url":"https://api.github.com/repos/teamendgame/endgame-chess/forks","keys_url":"https://api.github.com/repos/teamendgame/endgame-chess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teamendgame/endgame-chess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teamendgame/endgame-chess/teams","hooks_url":"https://api.github.com/repos/teamendgame/endgame-chess/hooks","issue_events_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues/events{/number}","events_url":"https://api.github.com/repos/teamendgame/endgame-chess/events","assignees_url":"https://api.github.com/repos/teamendgame/endgame-chess/assignees{/user}","branches_url":"https://api.github.com/repos/teamendgame/endgame-chess/branches{/branch}","tags_url":"https://api.github.com/repos/teamendgame/endgame-chess/tags","blobs_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/refs{/sha}","trees_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teamendgame/endgame-chess/statuses/{sha}","languages_url":"https://api.github.com/repos/teamendgame/endgame-chess/languages","stargazers_url":"https://api.github.com/repos/teamendgame/endgame-chess/stargazers","contributors_url":"https://api.github.com/repos/teamendgame/endgame-chess/contributors","subscribers_url":"https://api.github.com/repos/teamendgame/endgame-chess/subscribers","subscription_url":"https://api.github.com/repos/teamendgame/endgame-chess/subscription","commits_url":"https://api.github.com/repos/teamendgame/endgame-chess/commits{/sha}","git_commits_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/commits{/sha}","comments_url":"https://api.github.com/repos/teamendgame/endgame-chess/comments{/number}","issue_comment_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues/comments{/number}","contents_url":"https://api.github.com/repos/teamendgame/endgame-chess/contents/{+path}","compare_url":"https://api.github.com/repos/teamendgame/endgame-chess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teamendgame/endgame-chess/merges","archive_url":"https://api.github.com/repos/teamendgame/endgame-chess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teamendgame/endgame-chess/downloads","issues_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues{/number}","pulls_url":"https://api.github.com/repos/teamendgame/endgame-chess/pulls{/number}","milestones_url":"https://api.github.com/repos/teamendgame/endgame-chess/milestones{/number}","notifications_url":"https://api.github.com/repos/teamendgame/endgame-chess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teamendgame/endgame-chess/labels{/name}","releases_url":"https://api.github.com/repos/teamendgame/endgame-chess/releases{/id}","created_at":"2015-10-31T00:45:15Z","updated_at":"2015-12-01T15:47:50Z","pushed_at":"2015-12-27T15:16:28Z","git_url":"git://github.com/teamendgame/endgame-chess.git","ssh_url":"git@github.com:teamendgame/endgame-chess.git","clone_url":"https://github.com/teamendgame/endgame-chess.git","svn_url":"https://github.com/teamendgame/endgame-chess","homepage":"http://endgame-chess.herokuapp.com/","size":274,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"teamendgame:master","ref":"master","sha":"dfef40228fb3cf0384fc8341dc1fc7beacfcfb33","user":{"login":"teamendgame","id":15490891,"avatar_url":"https://avatars.githubusercontent.com/u/15490891?v=3","gravatar_id":"","url":"https://api.github.com/users/teamendgame","html_url":"https://github.com/teamendgame","followers_url":"https://api.github.com/users/teamendgame/followers","following_url":"https://api.github.com/users/teamendgame/following{/other_user}","gists_url":"https://api.github.com/users/teamendgame/gists{/gist_id}","starred_url":"https://api.github.com/users/teamendgame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamendgame/subscriptions","organizations_url":"https://api.github.com/users/teamendgame/orgs","repos_url":"https://api.github.com/users/teamendgame/repos","events_url":"https://api.github.com/users/teamendgame/events{/privacy}","received_events_url":"https://api.github.com/users/teamendgame/received_events","type":"Organization","site_admin":false},"repo":{"id":45283424,"name":"endgame-chess","full_name":"teamendgame/endgame-chess","owner":{"login":"teamendgame","id":15490891,"avatar_url":"https://avatars.githubusercontent.com/u/15490891?v=3","gravatar_id":"","url":"https://api.github.com/users/teamendgame","html_url":"https://github.com/teamendgame","followers_url":"https://api.github.com/users/teamendgame/followers","following_url":"https://api.github.com/users/teamendgame/following{/other_user}","gists_url":"https://api.github.com/users/teamendgame/gists{/gist_id}","starred_url":"https://api.github.com/users/teamendgame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamendgame/subscriptions","organizations_url":"https://api.github.com/users/teamendgame/orgs","repos_url":"https://api.github.com/users/teamendgame/repos","events_url":"https://api.github.com/users/teamendgame/events{/privacy}","received_events_url":"https://api.github.com/users/teamendgame/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/teamendgame/endgame-chess","description":"","fork":false,"url":"https://api.github.com/repos/teamendgame/endgame-chess","forks_url":"https://api.github.com/repos/teamendgame/endgame-chess/forks","keys_url":"https://api.github.com/repos/teamendgame/endgame-chess/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teamendgame/endgame-chess/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teamendgame/endgame-chess/teams","hooks_url":"https://api.github.com/repos/teamendgame/endgame-chess/hooks","issue_events_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues/events{/number}","events_url":"https://api.github.com/repos/teamendgame/endgame-chess/events","assignees_url":"https://api.github.com/repos/teamendgame/endgame-chess/assignees{/user}","branches_url":"https://api.github.com/repos/teamendgame/endgame-chess/branches{/branch}","tags_url":"https://api.github.com/repos/teamendgame/endgame-chess/tags","blobs_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/refs{/sha}","trees_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teamendgame/endgame-chess/statuses/{sha}","languages_url":"https://api.github.com/repos/teamendgame/endgame-chess/languages","stargazers_url":"https://api.github.com/repos/teamendgame/endgame-chess/stargazers","contributors_url":"https://api.github.com/repos/teamendgame/endgame-chess/contributors","subscribers_url":"https://api.github.com/repos/teamendgame/endgame-chess/subscribers","subscription_url":"https://api.github.com/repos/teamendgame/endgame-chess/subscription","commits_url":"https://api.github.com/repos/teamendgame/endgame-chess/commits{/sha}","git_commits_url":"https://api.github.com/repos/teamendgame/endgame-chess/git/commits{/sha}","comments_url":"https://api.github.com/repos/teamendgame/endgame-chess/comments{/number}","issue_comment_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues/comments{/number}","contents_url":"https://api.github.com/repos/teamendgame/endgame-chess/contents/{+path}","compare_url":"https://api.github.com/repos/teamendgame/endgame-chess/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teamendgame/endgame-chess/merges","archive_url":"https://api.github.com/repos/teamendgame/endgame-chess/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teamendgame/endgame-chess/downloads","issues_url":"https://api.github.com/repos/teamendgame/endgame-chess/issues{/number}","pulls_url":"https://api.github.com/repos/teamendgame/endgame-chess/pulls{/number}","milestones_url":"https://api.github.com/repos/teamendgame/endgame-chess/milestones{/number}","notifications_url":"https://api.github.com/repos/teamendgame/endgame-chess/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teamendgame/endgame-chess/labels{/name}","releases_url":"https://api.github.com/repos/teamendgame/endgame-chess/releases{/id}","created_at":"2015-10-31T00:45:15Z","updated_at":"2015-12-01T15:47:50Z","pushed_at":"2015-12-27T15:16:28Z","git_url":"git://github.com/teamendgame/endgame-chess.git","ssh_url":"git@github.com:teamendgame/endgame-chess.git","clone_url":"https://github.com/teamendgame/endgame-chess.git","svn_url":"https://github.com/teamendgame/endgame-chess","homepage":"http://endgame-chess.herokuapp.com/","size":274,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/70"},"html":{"href":"https://github.com/teamendgame/endgame-chess/pull/70"},"issue":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/issues/70"},"comments":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/teamendgame/endgame-chess/statuses/bef8fac5cf9718d772373e50d0dd111233f63d57"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":6,"additions":114,"deletions":8,"changed_files":8}}