{"action":"created","comment":{"url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/comments/26229526","id":26229526,"diff_hunk":"@@ -10,12 +10,36 @@ def sort\n   def query\n     {\n       'filtered': {\n-        'filter': {\n-          'in': {\n-            'other_advice_methods': object.remote_advice_method_ids\n+        'filter': [\n+            {\n+              'in': {\n+                'other_advice_methods': object.remote_advice_method_ids\n+              }\n+            }\n+       ]\n+      }\n+    }.tap do |query|\n+      if types_of_advice?\n+        query[:filtered][:filter] << {\n+          'script': {\n+            'script': types_of_advice_filter_expression\n           }\n         }\n-      }\n-    }\n+      end\n+    end\n+  end\n+\n+  private\n+\n+  def types_of_advice_filter_expression\n+    chosen_types_of_advice_fields.map { |field| \"#{field} > 0\" }.join(' && ')\n+  end\n+\n+  def chosen_types_of_advice_fields","path":"app/serializers/remote_search_form_serializer.rb","position":34,"original_position":34,"commit_id":"28d25811434eda13d61614cffe1d8fd2c0a9c9d3","original_commit_id":"28d25811434eda13d61614cffe1d8fd2c0a9c9d3","user":{"login":"esbel","id":106796,"avatar_url":"https://avatars.githubusercontent.com/u/106796?v=3","gravatar_id":"","url":"https://api.github.com/users/esbel","html_url":"https://github.com/esbel","followers_url":"https://api.github.com/users/esbel/followers","following_url":"https://api.github.com/users/esbel/following{/other_user}","gists_url":"https://api.github.com/users/esbel/gists{/gist_id}","starred_url":"https://api.github.com/users/esbel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbel/subscriptions","organizations_url":"https://api.github.com/users/esbel/orgs","repos_url":"https://api.github.com/users/esbel/repos","events_url":"https://api.github.com/users/esbel/events{/privacy}","received_events_url":"https://api.github.com/users/esbel/received_events","type":"User","site_admin":false},"body":"so what you suggest for this?","created_at":"2015-03-11T16:38:43Z","updated_at":"2015-03-11T16:38:43Z","html_url":"https://github.com/moneyadviceservice/rad_consumer/pull/48#discussion_r26229526","pull_request_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/comments/26229526"},"html":{"href":"https://github.com/moneyadviceservice/rad_consumer/pull/48#discussion_r26229526"},"pull_request":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48","id":30959538,"html_url":"https://github.com/moneyadviceservice/rad_consumer/pull/48","diff_url":"https://github.com/moneyadviceservice/rad_consumer/pull/48.diff","patch_url":"https://github.com/moneyadviceservice/rad_consumer/pull/48.patch","issue_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/48","number":48,"state":"open","locked":false,"title":"#5725 Support for filtering by advice type","user":{"login":"esbel","id":106796,"avatar_url":"https://avatars.githubusercontent.com/u/106796?v=3","gravatar_id":"","url":"https://api.github.com/users/esbel","html_url":"https://github.com/esbel","followers_url":"https://api.github.com/users/esbel/followers","following_url":"https://api.github.com/users/esbel/following{/other_user}","gists_url":"https://api.github.com/users/esbel/gists{/gist_id}","starred_url":"https://api.github.com/users/esbel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbel/subscriptions","organizations_url":"https://api.github.com/users/esbel/orgs","repos_url":"https://api.github.com/users/esbel/repos","events_url":"https://api.github.com/users/esbel/events{/privacy}","received_events_url":"https://api.github.com/users/esbel/received_events","type":"User","site_admin":false},"body":"Scenario #4 of #5725:\r\n\r\n```\r\nScenario: Selecting phone and/or online advice with advice filters\r\nGiven that I am on the RAD landing page\r\nWhen I submit a search selecting online and/or phone advice with selected 'types of advice' filters\r\nThen I am show FIRMS AND SUBSIDIARIES that provide advice by phone and/or online (based on the rules above for selecting phone advice, online advice or phone and online advice)\r\nAnd provide the 'type of advice' I have selected \r\nAnd are ordered in alphabetical order (A-Z)\r\n```\r\n\r\nImplementation is partially based on existing implementation of filters for `SearchForm`.","created_at":"2015-03-11T16:24:12Z","updated_at":"2015-03-11T16:38:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"afbf569e37dbc3fa78caf28880a3de52924593b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48/commits","review_comments_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48/comments","review_comment_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/48/comments","statuses_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/statuses/28d25811434eda13d61614cffe1d8fd2c0a9c9d3","head":{"label":"moneyadviceservice:remote-advice-filters","ref":"remote-advice-filters","sha":"28d25811434eda13d61614cffe1d8fd2c0a9c9d3","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":30410520,"name":"rad_consumer","full_name":"moneyadviceservice/rad_consumer","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/rad_consumer","description":"Consumer search for the Retirement Adviser Directory","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/rad_consumer","forks_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/releases{/id}","created_at":"2015-02-06T12:08:20Z","updated_at":"2015-03-11T16:32:17Z","pushed_at":"2015-03-11T16:32:17Z","git_url":"git://github.com/moneyadviceservice/rad_consumer.git","ssh_url":"git@github.com:moneyadviceservice/rad_consumer.git","clone_url":"https://github.com/moneyadviceservice/rad_consumer.git","svn_url":"https://github.com/moneyadviceservice/rad_consumer","homepage":null,"size":1796,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"moneyadviceservice:master","ref":"master","sha":"06d136c3c3a6d40fd42a93e73034b2765d9b2749","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":30410520,"name":"rad_consumer","full_name":"moneyadviceservice/rad_consumer","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/rad_consumer","description":"Consumer search for the Retirement Adviser Directory","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/rad_consumer","forks_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/rad_consumer/releases{/id}","created_at":"2015-02-06T12:08:20Z","updated_at":"2015-03-11T16:32:17Z","pushed_at":"2015-03-11T16:32:17Z","git_url":"git://github.com/moneyadviceservice/rad_consumer.git","ssh_url":"git@github.com:moneyadviceservice/rad_consumer.git","clone_url":"https://github.com/moneyadviceservice/rad_consumer.git","svn_url":"https://github.com/moneyadviceservice/rad_consumer","homepage":null,"size":1796,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48"},"html":{"href":"https://github.com/moneyadviceservice/rad_consumer/pull/48"},"issue":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/48"},"comments":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/moneyadviceservice/rad_consumer/statuses/28d25811434eda13d61614cffe1d8fd2c0a9c9d3"}}}}