{"action":"created","comment":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/76365273","id":76365273,"diff_hunk":"@@ -13,11 +13,16 @@ def index\n     respond_to do |format|\n       format.html { }\n       format.json do\n-        @users = User\n-        if params[:search]\n-          @users = @users.where(\"name LIKE :input OR wca_id LIKE :input OR email LIKE :input\", { input: \"%#{params[:search]}%\" })\n+        @users = User.joins(\"INNER JOIN Countries ON iso2 = country_iso2\")\n+        params[:search]&.split&.each do |part|\n+          like_query = %w(users.name wca_id email Countries.name).map do |column|\n+            column + \" LIKE :part\"\n+          end.join(\" OR \")\n+          @users = @users.where(like_query, { part: \"%#{part}%\" })\n         end\n-        if params[:sort]\n+        if params[:sort] == \"country\"\n+          @users = @users.order(\"Countries.name #{params[:order] == \"asc\" ? \"asc\" : \"desc\"}\")","path":"WcaOnRails/app/controllers/users_controller.rb","position":null,"original_position":16,"commit_id":"30ad5aa33ab9c0470af44db136848361f797285f","original_commit_id":"c8933490249069ae1419656b08267e9729ba6304","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":"Sounds good, have you done it before? I guees that we need to create a new logger for ActiveRecord which will log to StringIO? I'll try when I'm back from competition.","created_at":"2016-08-26T05:17:08Z","updated_at":"2016-08-26T05:17:08Z","html_url":"https://github.com/cubing/worldcubeassociation.org/pull/829#discussion_r76365273","pull_request_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829","_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/76365273"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/829#discussion_r76365273"},"pull_request":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829"}}},"pull_request":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829","id":82719771,"html_url":"https://github.com/cubing/worldcubeassociation.org/pull/829","diff_url":"https://github.com/cubing/worldcubeassociation.org/pull/829.diff","patch_url":"https://github.com/cubing/worldcubeassociation.org/pull/829.patch","issue_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/829","number":829,"state":"open","locked":false,"title":"Split search query on the users index page and add Country column","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":"This allows using more flexible queries on the users index page like `<name part> <country>` and shows Country.","created_at":"2016-08-25T13:30:38Z","updated_at":"2016-08-26T05:17:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5f2dc37e835c6eafbc87840b8f65189c8826bf9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829/commits","review_comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829/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/829/comments","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/30ad5aa33ab9c0470af44db136848361f797285f","head":{"label":"jonatanklosko:users-index-search","ref":"users-index-search","sha":"30ad5aa33ab9c0470af44db136848361f797285f","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-06-24T20:22:48Z","pushed_at":"2016-08-25T20:19:25Z","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":52512,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cubing:master","ref":"master","sha":"9abb59e1b3da9a4cfadc06d104eb0e43ead19647","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-07-31T18:31:59Z","pushed_at":"2016-08-25T20:19:26Z","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":56077,"stargazers_count":22,"watchers_count":22,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":177,"forks":29,"open_issues":177,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/829"},"issue":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/829"},"comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/829/comments"},"review_comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/829/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/829/commits"},"statuses":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/30ad5aa33ab9c0470af44db136848361f797285f"}}}}
{"actor":{"display_login":"jonatanklosko"}}