{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/frontend/pulls/comments/44259825","id":44259825,"diff_hunk":"@@ -109,12 +110,58 @@ def publication\n       end\n \n       @interaction_details = prepare_interaction_details(@publication, authority_slug, snac)\n+    elsif @publication.format == 'local_transaction'\n+      @location = fetch_location @postcode\n+\n+      if @location.nil?\n+        @postcode_error = \"fullPostcodeNoMapitMatch\"","path":"app/controllers/root_controller.rb","position":41,"original_position":41,"commit_id":"c58813d9f4c35bd4b19783220643587c4f781460","original_commit_id":"c58813d9f4c35bd4b19783220643587c4f781460","user":{"login":"tommyp","id":449004,"avatar_url":"https://avatars.githubusercontent.com/u/449004?v=3","gravatar_id":"","url":"https://api.github.com/users/tommyp","html_url":"https://github.com/tommyp","followers_url":"https://api.github.com/users/tommyp/followers","following_url":"https://api.github.com/users/tommyp/following{/other_user}","gists_url":"https://api.github.com/users/tommyp/gists{/gist_id}","starred_url":"https://api.github.com/users/tommyp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommyp/subscriptions","organizations_url":"https://api.github.com/users/tommyp/orgs","repos_url":"https://api.github.com/users/tommyp/repos","events_url":"https://api.github.com/users/tommyp/events{/privacy}","received_events_url":"https://api.github.com/users/tommyp/received_events","type":"User","site_admin":false},"body":"When `fetch_location` returns `nil`, it's the equivalent of a 404 from Mapit. That case happens when there is no match but it is a Postcode.","created_at":"2015-11-09T10:27:32Z","updated_at":"2015-11-09T10:27:32Z","html_url":"https://github.com/alphagov/frontend/pull/894#discussion_r44259825","pull_request_url":"https://api.github.com/repos/alphagov/frontend/pulls/894","_links":{"self":{"href":"https://api.github.com/repos/alphagov/frontend/pulls/comments/44259825"},"html":{"href":"https://github.com/alphagov/frontend/pull/894#discussion_r44259825"},"pull_request":{"href":"https://api.github.com/repos/alphagov/frontend/pulls/894"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/frontend/pulls/894","id":49975672,"html_url":"https://github.com/alphagov/frontend/pull/894","diff_url":"https://github.com/alphagov/frontend/pull/894.diff","patch_url":"https://github.com/alphagov/frontend/pull/894.patch","issue_url":"https://api.github.com/repos/alphagov/frontend/issues/894","number":894,"state":"open","locked":false,"title":"Log postcode errors","user":{"login":"tommyp","id":449004,"avatar_url":"https://avatars.githubusercontent.com/u/449004?v=3","gravatar_id":"","url":"https://api.github.com/users/tommyp","html_url":"https://github.com/tommyp","followers_url":"https://api.github.com/users/tommyp/followers","following_url":"https://api.github.com/users/tommyp/following{/other_user}","gists_url":"https://api.github.com/users/tommyp/gists{/gist_id}","starred_url":"https://api.github.com/users/tommyp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommyp/subscriptions","organizations_url":"https://api.github.com/users/tommyp/orgs","repos_url":"https://api.github.com/users/tommyp/repos","events_url":"https://api.github.com/users/tommyp/events{/privacy}","received_events_url":"https://api.github.com/users/tommyp/received_events","type":"User","site_admin":false},"body":"In order to improve the experience for users on local transactions we need to log the error states from the Postcode form. In order to know if the difference between a bad Postcode and a good Postcode with no Mapit match I've bumped `gds-api-adapters to `25.0.0` to include the change in https://github.com/alphagov/gds-api-adapters/pull/381. This means that when entering a bad postcode, the API adapter will return a exception with a 400 code. We can then use this to log the error state.\r\n\r\nThis PR does that by unfortunately duplicating the code in the `publication` action and added setting an instance var with the error of the variable state. This is also sent to Google Analytics in the template. These error state strings came from our Analyst. The idea is we will be able to scale back duplication as we continue to improve the local transaction format.\r\n\r\nThis change also picked up a load of lint offences, so the PR also fixes a bunch of those. [Ticket](https://trello.com/c/Db6csIA7/135-log-the-errors-users-see-when-entering-postcodes-on-local-transaction-pages).","created_at":"2015-11-06T16:40:59Z","updated_at":"2015-11-09T10:27:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5feeafe66a6f2c8317c25904aafd9d5973b8b458","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/frontend/pulls/894/commits","review_comments_url":"https://api.github.com/repos/alphagov/frontend/pulls/894/comments","review_comment_url":"https://api.github.com/repos/alphagov/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/frontend/issues/894/comments","statuses_url":"https://api.github.com/repos/alphagov/frontend/statuses/c58813d9f4c35bd4b19783220643587c4f781460","head":{"label":"alphagov:log-postcode-errors","ref":"log-postcode-errors","sha":"c58813d9f4c35bd4b19783220643587c4f781460","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2331534,"name":"frontend","full_name":"alphagov/frontend","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/frontend","description":"Application to serve mainstream formats, the homepage, and search for the GOV.UK single domain.","fork":false,"url":"https://api.github.com/repos/alphagov/frontend","forks_url":"https://api.github.com/repos/alphagov/frontend/forks","keys_url":"https://api.github.com/repos/alphagov/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/frontend/teams","hooks_url":"https://api.github.com/repos/alphagov/frontend/hooks","issue_events_url":"https://api.github.com/repos/alphagov/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/frontend/events","assignees_url":"https://api.github.com/repos/alphagov/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/frontend/tags","blobs_url":"https://api.github.com/repos/alphagov/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/frontend/languages","stargazers_url":"https://api.github.com/repos/alphagov/frontend/stargazers","contributors_url":"https://api.github.com/repos/alphagov/frontend/contributors","subscribers_url":"https://api.github.com/repos/alphagov/frontend/subscribers","subscription_url":"https://api.github.com/repos/alphagov/frontend/subscription","commits_url":"https://api.github.com/repos/alphagov/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/frontend/merges","archive_url":"https://api.github.com/repos/alphagov/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/frontend/downloads","issues_url":"https://api.github.com/repos/alphagov/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/frontend/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/frontend/releases{/id}","created_at":"2011-09-06T00:16:08Z","updated_at":"2015-11-05T15:02:00Z","pushed_at":"2015-11-06T16:41:01Z","git_url":"git://github.com/alphagov/frontend.git","ssh_url":"git@github.com:alphagov/frontend.git","clone_url":"https://github.com/alphagov/frontend.git","svn_url":"https://github.com/alphagov/frontend","homepage":"https://www.gov.uk/","size":36904,"stargazers_count":202,"watchers_count":202,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":3,"forks":37,"open_issues":3,"watchers":202,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"934dc21cc4af2b513cbe989b2584aa500b4a5097","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2331534,"name":"frontend","full_name":"alphagov/frontend","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/frontend","description":"Application to serve mainstream formats, the homepage, and search for the GOV.UK single domain.","fork":false,"url":"https://api.github.com/repos/alphagov/frontend","forks_url":"https://api.github.com/repos/alphagov/frontend/forks","keys_url":"https://api.github.com/repos/alphagov/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/frontend/teams","hooks_url":"https://api.github.com/repos/alphagov/frontend/hooks","issue_events_url":"https://api.github.com/repos/alphagov/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/frontend/events","assignees_url":"https://api.github.com/repos/alphagov/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/frontend/tags","blobs_url":"https://api.github.com/repos/alphagov/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/frontend/languages","stargazers_url":"https://api.github.com/repos/alphagov/frontend/stargazers","contributors_url":"https://api.github.com/repos/alphagov/frontend/contributors","subscribers_url":"https://api.github.com/repos/alphagov/frontend/subscribers","subscription_url":"https://api.github.com/repos/alphagov/frontend/subscription","commits_url":"https://api.github.com/repos/alphagov/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/frontend/merges","archive_url":"https://api.github.com/repos/alphagov/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/frontend/downloads","issues_url":"https://api.github.com/repos/alphagov/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/frontend/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/frontend/releases{/id}","created_at":"2011-09-06T00:16:08Z","updated_at":"2015-11-05T15:02:00Z","pushed_at":"2015-11-06T16:41:01Z","git_url":"git://github.com/alphagov/frontend.git","ssh_url":"git@github.com:alphagov/frontend.git","clone_url":"https://github.com/alphagov/frontend.git","svn_url":"https://github.com/alphagov/frontend","homepage":"https://www.gov.uk/","size":36904,"stargazers_count":202,"watchers_count":202,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":3,"forks":37,"open_issues":3,"watchers":202,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/frontend/pulls/894"},"html":{"href":"https://github.com/alphagov/frontend/pull/894"},"issue":{"href":"https://api.github.com/repos/alphagov/frontend/issues/894"},"comments":{"href":"https://api.github.com/repos/alphagov/frontend/issues/894/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/frontend/pulls/894/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/frontend/pulls/894/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/frontend/statuses/c58813d9f4c35bd4b19783220643587c4f781460"}}}}