{"action":"created","comment":{"url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/comments/206715248","pull_request_review_id":142182637,"id":206715248,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjcxNTI0OA==","diff_hunk":"@@ -23,40 +23,49 @@ def membership_periods_cannot_overlap_for_single_user\n     end\n   end\n \n+  # Code duplication from Cachable concern, as we index by friendly_id and not by id :(\n+  def self.c_all_by_friendly_id\n+    @@teams_by_friendly_id ||= all.index_by(&:friendly_id)","path":"WcaOnRails/app/models/team.rb","position":6,"original_position":6,"commit_id":"cd2ad8891f9b0b28c2166cd70de797342a73bf88","original_commit_id":"cd2ad8891f9b0b28c2166cd70de797342a73bf88","user":{"login":"jfly","id":277474,"node_id":"MDQ6VXNlcjI3NzQ3NA==","avatar_url":"https://avatars1.githubusercontent.com/u/277474?v=4","gravatar_id":"","url":"https://api.github.com/users/jfly","html_url":"https://github.com/jfly","followers_url":"https://api.github.com/users/jfly/followers","following_url":"https://api.github.com/users/jfly/following{/other_user}","gists_url":"https://api.github.com/users/jfly/gists{/gist_id}","starred_url":"https://api.github.com/users/jfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfly/subscriptions","organizations_url":"https://api.github.com/users/jfly/orgs","repos_url":"https://api.github.com/users/jfly/repos","events_url":"https://api.github.com/users/jfly/events{/privacy}","received_events_url":"https://api.github.com/users/jfly/received_events","type":"User","site_admin":false},"body":"Yes, let's get rid of the checkbox for hidden as well! However, it would be nice to add some text saying something like \"this team is hidden\"","created_at":"2018-07-31T23:29:50Z","updated_at":"2018-07-31T23:29:50Z","html_url":"https://github.com/thewca/worldcubeassociation.org/pull/3132#discussion_r206715248","pull_request_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/comments/206715248"},"html":{"href":"https://github.com/thewca/worldcubeassociation.org/pull/3132#discussion_r206715248"},"pull_request":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132"}},"in_reply_to_id":206713639},"pull_request":{"url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132","id":204174010,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MTc0MDEw","html_url":"https://github.com/thewca/worldcubeassociation.org/pull/3132","diff_url":"https://github.com/thewca/worldcubeassociation.org/pull/3132.diff","patch_url":"https://github.com/thewca/worldcubeassociation.org/pull/3132.patch","issue_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues/3132","number":3132,"state":"closed","locked":false,"title":"Slight performance improvements","user":{"login":"viroulep","id":1007485,"node_id":"MDQ6VXNlcjEwMDc0ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/1007485?v=4","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"body":"I noticed that the rails console was spammed with team_members SQL select queries for any small page request, so I investigated a bit and it resulted in two changes:\r\n\r\n  - cache teams, as we have a few of them and we need to get information about them very *very* often!\r\n  - includes \"current_team_members\" association for current_user, as it is used very *very* often (everytime we call a 'wrc_member?' or alike), and as it fires a SQL select everytime(!!).\r\n\r\nI don't have much precise number as my local server is not the only thing running on my computer, but I saw the average request completed time for the home page drop from ~300ms to ~260ms (not counting the first few requests that load the code obviously).\r\nIt also might just be saving the time needed to create the log output, but in any case I don't see any downside to these changes.","created_at":"2018-07-26T15:06:40Z","updated_at":"2018-07-31T23:29:50Z","closed_at":"2018-07-31T18:48:37Z","merged_at":"2018-07-31T18:48:37Z","merge_commit_sha":"f4d3a2125e60892610055c304f4fd12cdaba2d0e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132/commits","review_comments_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132/comments","review_comment_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues/3132/comments","statuses_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/statuses/cd2ad8891f9b0b28c2166cd70de797342a73bf88","head":{"label":"viroulep:cached-teams","ref":"cached-teams","sha":"cd2ad8891f9b0b28c2166cd70de797342a73bf88","user":{"login":"viroulep","id":1007485,"node_id":"MDQ6VXNlcjEwMDc0ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/1007485?v=4","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"repo":{"id":49994335,"node_id":"MDEwOlJlcG9zaXRvcnk0OTk5NDMzNQ==","name":"worldcubeassociation.org","full_name":"viroulep/worldcubeassociation.org","owner":{"login":"viroulep","id":1007485,"node_id":"MDQ6VXNlcjEwMDc0ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/1007485?v=4","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/viroulep/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":true,"url":"https://api.github.com/repos/viroulep/worldcubeassociation.org","forks_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/deployments","created_at":"2016-01-20T01:01:37Z","updated_at":"2018-07-03T21:14:57Z","pushed_at":"2018-07-31T22:05:25Z","git_url":"git://github.com/viroulep/worldcubeassociation.org.git","ssh_url":"git@github.com:viroulep/worldcubeassociation.org.git","clone_url":"https://github.com/viroulep/worldcubeassociation.org.git","svn_url":"https://github.com/viroulep/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":114939,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"thewca:master","ref":"master","sha":"57e630d993d8e238dd3d439b80d742b9ec0f0555","user":{"login":"thewca","id":19806436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5ODA2NDM2","avatar_url":"https://avatars0.githubusercontent.com/u/19806436?v=4","gravatar_id":"","url":"https://api.github.com/users/thewca","html_url":"https://github.com/thewca","followers_url":"https://api.github.com/users/thewca/followers","following_url":"https://api.github.com/users/thewca/following{/other_user}","gists_url":"https://api.github.com/users/thewca/gists{/gist_id}","starred_url":"https://api.github.com/users/thewca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thewca/subscriptions","organizations_url":"https://api.github.com/users/thewca/orgs","repos_url":"https://api.github.com/users/thewca/repos","events_url":"https://api.github.com/users/thewca/events{/privacy}","received_events_url":"https://api.github.com/users/thewca/received_events","type":"Organization","site_admin":false},"repo":{"id":34161579,"node_id":"MDEwOlJlcG9zaXRvcnkzNDE2MTU3OQ==","name":"worldcubeassociation.org","full_name":"thewca/worldcubeassociation.org","owner":{"login":"thewca","id":19806436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5ODA2NDM2","avatar_url":"https://avatars0.githubusercontent.com/u/19806436?v=4","gravatar_id":"","url":"https://api.github.com/users/thewca","html_url":"https://github.com/thewca","followers_url":"https://api.github.com/users/thewca/followers","following_url":"https://api.github.com/users/thewca/following{/other_user}","gists_url":"https://api.github.com/users/thewca/gists{/gist_id}","starred_url":"https://api.github.com/users/thewca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thewca/subscriptions","organizations_url":"https://api.github.com/users/thewca/orgs","repos_url":"https://api.github.com/users/thewca/repos","events_url":"https://api.github.com/users/thewca/events{/privacy}","received_events_url":"https://api.github.com/users/thewca/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thewca/worldcubeassociation.org","description":"All of the code that runs on worldcubeassociation.org","fork":false,"url":"https://api.github.com/repos/thewca/worldcubeassociation.org","forks_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/thewca/worldcubeassociation.org/deployments","created_at":"2015-04-18T10:21:53Z","updated_at":"2018-07-31T23:27:37Z","pushed_at":"2018-07-31T23:27:34Z","git_url":"git://github.com/thewca/worldcubeassociation.org.git","ssh_url":"git@github.com:thewca/worldcubeassociation.org.git","clone_url":"https://github.com/thewca/worldcubeassociation.org.git","svn_url":"https://github.com/thewca/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":124966,"stargazers_count":76,"watchers_count":76,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"archived":false,"open_issues_count":242,"license":null,"forks":57,"open_issues":242,"watchers":76,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132"},"html":{"href":"https://github.com/thewca/worldcubeassociation.org/pull/3132"},"issue":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues/3132"},"comments":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/issues/3132/comments"},"review_comments":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132/comments"},"review_comment":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/pulls/3132/commits"},"statuses":{"href":"https://api.github.com/repos/thewca/worldcubeassociation.org/statuses/cd2ad8891f9b0b28c2166cd70de797342a73bf88"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jfly"}}