{"action":"created","issue":{"url":"https://api.github.com/repos/IgorLeonenko/matches/issues/7","repository_url":"https://api.github.com/repos/IgorLeonenko/matches","labels_url":"https://api.github.com/repos/IgorLeonenko/matches/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/IgorLeonenko/matches/issues/7/comments","events_url":"https://api.github.com/repos/IgorLeonenko/matches/issues/7/events","html_url":"https://github.com/IgorLeonenko/matches/pull/7","id":185707698,"number":7,"title":"Api","user":{"login":"IgorLeonenko","id":5030002,"avatar_url":"https://avatars.githubusercontent.com/u/5030002?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorLeonenko","html_url":"https://github.com/IgorLeonenko","followers_url":"https://api.github.com/users/IgorLeonenko/followers","following_url":"https://api.github.com/users/IgorLeonenko/following{/other_user}","gists_url":"https://api.github.com/users/IgorLeonenko/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorLeonenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorLeonenko/subscriptions","organizations_url":"https://api.github.com/users/IgorLeonenko/orgs","repos_url":"https://api.github.com/users/IgorLeonenko/repos","events_url":"https://api.github.com/users/IgorLeonenko/events{/privacy}","received_events_url":"https://api.github.com/users/IgorLeonenko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":42,"created_at":"2016-10-27T15:48:15Z","updated_at":"2016-11-09T15:16:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/IgorLeonenko/matches/pulls/7","html_url":"https://github.com/IgorLeonenko/matches/pull/7","diff_url":"https://github.com/IgorLeonenko/matches/pull/7.diff","patch_url":"https://github.com/IgorLeonenko/matches/pull/7.patch"},"body":"<!-- Reviewable:start -->\n\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/igorleonenko/matches/7)\n\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/IgorLeonenko/matches/issues/comments/259438438","html_url":"https://github.com/IgorLeonenko/matches/pull/7#issuecomment-259438438","issue_url":"https://api.github.com/repos/IgorLeonenko/matches/issues/7","id":259438438,"user":{"login":"kapone89","id":1898786,"avatar_url":"https://avatars.githubusercontent.com/u/1898786?v=3","gravatar_id":"","url":"https://api.github.com/users/kapone89","html_url":"https://github.com/kapone89","followers_url":"https://api.github.com/users/kapone89/followers","following_url":"https://api.github.com/users/kapone89/following{/other_user}","gists_url":"https://api.github.com/users/kapone89/gists{/gist_id}","starred_url":"https://api.github.com/users/kapone89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapone89/subscriptions","organizations_url":"https://api.github.com/users/kapone89/orgs","repos_url":"https://api.github.com/users/kapone89/repos","events_url":"https://api.github.com/users/kapone89/events{/privacy}","received_events_url":"https://api.github.com/users/kapone89/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T15:16:49Z","updated_at":"2016-11-09T15:16:49Z","body":"\n\n\n\nReviewed 1 of 9 files at r6, 1 of 9 files at r7, 6 of 8 files at r8.\nReview status: 86 of 95 files reviewed at latest revision, 8 unresolved discussions.\n\n---\n\n*[app/controllers/api/v1/teams_controller.rb, line 8 at r6](https://reviewable.io:443/reviews/igorleonenko/matches/7#-KVzLS1UtJ3LhBwf4I17:-KW8aHoOVvbJgAMGML1J:bx2yc7w) ([raw file](https://github.com/igorleonenko/matches/blob/685dac49113df19cd4c4cd34e8f500d686598a8d/app/controllers/api/v1/teams_controller.rb#L8)):*\n<details><summary><i>Previously, kapone89 (Tomasz Kapłon) wrote…</i></summary>\n> When you refactor this method (as I described in model), transaction block will be necessary.\n</details>\n*won't be necessary. Sory for typo.\n\n---\n\n*[app/controllers/api/v1/teams_controller.rb, line 27 at r8](https://reviewable.io:443/reviews/igorleonenko/matches/7#-KW8ai-9f9p-z32zSHBX:-KW8ai-9f9p-z32zSHBY:b-b7a06s) ([raw file](https://github.com/igorleonenko/matches/blob/3afd647815832a106f7572a82b6cb06795b43be3/app/controllers/api/v1/teams_controller.rb#L27)):*\n> ```Ruby\n>         begin\n>           team.users.each do |user|\n>             tournament.users.delete(user)\n> ```\n\nThere are too many SQL queries. I will show you protip:\n```\nuser_ids = team.team_users.select(:user_id)\ntournament.tournament_users.where(user_id: user_ids).delete_all\n```\n\nHow many SQL queries we have here? Only one. Check if you don't believe ;-)\n\ndelete_all will execute SQL query without any model callbacks so make sure it's ok. Otherwise use destroy_all, which will execute more queries.\n\n---\n\n\n*Comments from [Reviewable](https://reviewable.io:443/reviews/igorleonenko/matches/7)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"kapone89"}}