{"action":"created","comment":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/58496786","id":58496786,"diff_hunk":"@@ -69,6 +62,15 @@ def index\n       @competitions = @competitions.select { |competition| competition.contains?(params[:search]) }\n     end\n \n+    unless params[:event_ids].empty?\n+      @competitions = @competitions.select do |competition|\n+        (competition.eventSpecs.split & params[:event_ids]).any?","path":"WcaOnRails/app/controllers/competitions_controller.rb","position":45,"original_position":45,"commit_id":"917a2034da96feb576afa73ffe1e9f22ae90a124","original_commit_id":"917a2034da96feb576afa73ffe1e9f22ae90a124","user":{"login":"jfly","id":277474,"avatar_url":"https://avatars.githubusercontent.com/u/277474?v=3","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":"I'm not wild about the implementation details of `eventSpecs` leaking out of the Competition model here. Would something like this work?\r\n\r\n```ruby\r\n  required_events = params[:event_ids].map { |event_id| Event.find(event_id) }\r\n  unless params[:event_ids].empty?\r\n    @competitions = @competitions.select do |competition|\r\n      (competition.events & required_events).any?\r\n```","created_at":"2016-04-05T07:27:30Z","updated_at":"2016-04-05T07:27:30Z","html_url":"https://github.com/cubing/worldcubeassociation.org/pull/461#discussion_r58496786","pull_request_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461","_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/58496786"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/461#discussion_r58496786"},"pull_request":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461"}}},"pull_request":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461","id":65077966,"html_url":"https://github.com/cubing/worldcubeassociation.org/pull/461","diff_url":"https://github.com/cubing/worldcubeassociation.org/pull/461.diff","patch_url":"https://github.com/cubing/worldcubeassociation.org/pull/461.patch","issue_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/461","number":461,"state":"open","locked":false,"title":"Add ability to search for competitions matching specific events.","user":{"login":"jonatanklosko","id":17034772,"avatar_url":"https://avatars.githubusercontent.com/u/17034772?v=3","gravatar_id":"","url":"https://api.github.com/users/jonatanklosko","html_url":"https://github.com/jonatanklosko","followers_url":"https://api.github.com/users/jonatanklosko/followers","following_url":"https://api.github.com/users/jonatanklosko/following{/other_user}","gists_url":"https://api.github.com/users/jonatanklosko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatanklosko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatanklosko/subscriptions","organizations_url":"https://api.github.com/users/jonatanklosko/orgs","repos_url":"https://api.github.com/users/jonatanklosko/repos","events_url":"https://api.github.com/users/jonatanklosko/events{/privacy}","received_events_url":"https://api.github.com/users/jonatanklosko/received_events","type":"User","site_admin":false},"body":"Fixes #448.\r\n![image](https://cloud.githubusercontent.com/assets/17034772/14234460/88c9539a-f9e3-11e5-9b4e-4bee864aebc2.png)\r\n","created_at":"2016-04-03T19:33:34Z","updated_at":"2016-04-05T07:27:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10f7bf96601ca9f205473c87970487d83764761c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461/commits","review_comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461/comments","review_comment_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/461/comments","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/917a2034da96feb576afa73ffe1e9f22ae90a124","head":{"label":"jonatanklosko:search-for-specific-events","ref":"search-for-specific-events","sha":"917a2034da96feb576afa73ffe1e9f22ae90a124","user":{"login":"jonatanklosko","id":17034772,"avatar_url":"https://avatars.githubusercontent.com/u/17034772?v=3","gravatar_id":"","url":"https://api.github.com/users/jonatanklosko","html_url":"https://github.com/jonatanklosko","followers_url":"https://api.github.com/users/jonatanklosko/followers","following_url":"https://api.github.com/users/jonatanklosko/following{/other_user}","gists_url":"https://api.github.com/users/jonatanklosko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatanklosko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatanklosko/subscriptions","organizations_url":"https://api.github.com/users/jonatanklosko/orgs","repos_url":"https://api.github.com/users/jonatanklosko/repos","events_url":"https://api.github.com/users/jonatanklosko/events{/privacy}","received_events_url":"https://api.github.com/users/jonatanklosko/received_events","type":"User","site_admin":false},"repo":{"id":54846746,"name":"worldcubeassociation.org","full_name":"jonatanklosko/worldcubeassociation.org","owner":{"login":"jonatanklosko","id":17034772,"avatar_url":"https://avatars.githubusercontent.com/u/17034772?v=3","gravatar_id":"","url":"https://api.github.com/users/jonatanklosko","html_url":"https://github.com/jonatanklosko","followers_url":"https://api.github.com/users/jonatanklosko/followers","following_url":"https://api.github.com/users/jonatanklosko/following{/other_user}","gists_url":"https://api.github.com/users/jonatanklosko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatanklosko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatanklosko/subscriptions","organizations_url":"https://api.github.com/users/jonatanklosko/orgs","repos_url":"https://api.github.com/users/jonatanklosko/repos","events_url":"https://api.github.com/users/jonatanklosko/events{/privacy}","received_events_url":"https://api.github.com/users/jonatanklosko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jonatanklosko/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":true,"url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org","forks_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/deployments","created_at":"2016-03-27T20:29:06Z","updated_at":"2016-03-27T20:29:13Z","pushed_at":"2016-04-04T19:10:09Z","git_url":"git://github.com/jonatanklosko/worldcubeassociation.org.git","ssh_url":"git@github.com:jonatanklosko/worldcubeassociation.org.git","clone_url":"https://github.com/jonatanklosko/worldcubeassociation.org.git","svn_url":"https://github.com/jonatanklosko/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":51148,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cubing:master","ref":"master","sha":"70ab9831b3d5b27b037eac5a10d44cc5414a96a8","user":{"login":"cubing","id":1092267,"avatar_url":"https://avatars.githubusercontent.com/u/1092267?v=3","gravatar_id":"","url":"https://api.github.com/users/cubing","html_url":"https://github.com/cubing","followers_url":"https://api.github.com/users/cubing/followers","following_url":"https://api.github.com/users/cubing/following{/other_user}","gists_url":"https://api.github.com/users/cubing/gists{/gist_id}","starred_url":"https://api.github.com/users/cubing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubing/subscriptions","organizations_url":"https://api.github.com/users/cubing/orgs","repos_url":"https://api.github.com/users/cubing/repos","events_url":"https://api.github.com/users/cubing/events{/privacy}","received_events_url":"https://api.github.com/users/cubing/received_events","type":"Organization","site_admin":false},"repo":{"id":34161579,"name":"worldcubeassociation.org","full_name":"cubing/worldcubeassociation.org","owner":{"login":"cubing","id":1092267,"avatar_url":"https://avatars.githubusercontent.com/u/1092267?v=3","gravatar_id":"","url":"https://api.github.com/users/cubing","html_url":"https://github.com/cubing","followers_url":"https://api.github.com/users/cubing/followers","following_url":"https://api.github.com/users/cubing/following{/other_user}","gists_url":"https://api.github.com/users/cubing/gists{/gist_id}","starred_url":"https://api.github.com/users/cubing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubing/subscriptions","organizations_url":"https://api.github.com/users/cubing/orgs","repos_url":"https://api.github.com/users/cubing/repos","events_url":"https://api.github.com/users/cubing/events{/privacy}","received_events_url":"https://api.github.com/users/cubing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cubing/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":false,"url":"https://api.github.com/repos/cubing/worldcubeassociation.org","forks_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/deployments","created_at":"2015-04-18T10:21:53Z","updated_at":"2016-03-30T08:30:49Z","pushed_at":"2016-04-04T23:00:38Z","git_url":"git://github.com/cubing/worldcubeassociation.org.git","ssh_url":"git@github.com:cubing/worldcubeassociation.org.git","clone_url":"https://github.com/cubing/worldcubeassociation.org.git","svn_url":"https://github.com/cubing/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":54337,"stargazers_count":10,"watchers_count":10,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":152,"forks":22,"open_issues":152,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/461"},"issue":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/461"},"comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/461/comments"},"review_comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461/comments"},"review_comment":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/461/commits"},"statuses":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/917a2034da96feb576afa73ffe1e9f22ae90a124"}}}}