{"action":"closed","number":2590,"pull_request":{"url":"https://api.github.com/repos/alphagov/whitehall/pulls/2590","id":69872301,"html_url":"https://github.com/alphagov/whitehall/pull/2590","diff_url":"https://github.com/alphagov/whitehall/pull/2590.diff","patch_url":"https://github.com/alphagov/whitehall/pull/2590.patch","issue_url":"https://api.github.com/repos/alphagov/whitehall/issues/2590","number":2590,"state":"closed","locked":false,"title":"Dedupe related detailed guide content ids","user":{"login":"tvararu","id":1650875,"avatar_url":"https://avatars.githubusercontent.com/u/1650875?v=3","gravatar_id":"","url":"https://api.github.com/users/tvararu","html_url":"https://github.com/tvararu","followers_url":"https://api.github.com/users/tvararu/followers","following_url":"https://api.github.com/users/tvararu/following{/other_user}","gists_url":"https://api.github.com/users/tvararu/gists{/gist_id}","starred_url":"https://api.github.com/users/tvararu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvararu/subscriptions","organizations_url":"https://api.github.com/users/tvararu/orgs","repos_url":"https://api.github.com/users/tvararu/repos","events_url":"https://api.github.com/users/tvararu/events{/privacy}","received_events_url":"https://api.github.com/users/tvararu/received_events","type":"User","site_admin":false},"body":"It's possible for a detailed guide to be related to a number of distinct editions which all map to the same `content_id`.\r\n\r\nAn example for this is https://www.gov.uk/guidance/military-end-use-control-guidance-notes.\r\n\r\nIt links to 140 different editions:\r\n\r\n```ruby\r\n> d = Document.find_by_slug(\"military-end-use-control-guidance-notes\")\r\n> dg = d.latest_edition\r\n> dg.related_to_editions.map(&:id)\r\n[3820, 17587, 221635, 315251, 497743, 3855, 7874, 8878, 17292, 581237,\r\n3860, ...]\r\n```\r\n\r\nBut the editions themselves are linked to only 12 distinct detailed guides, so they have lots of duplicated `content_ids`:\r\n\r\n```ruby\r\n> dg.related_to_editions.map(&:content_id)\r\n[\"5c716f08-7631-11e4-a3cb-005056011aef\", \"5c716f08-7631-11e4-a3cb-005056011aef\", ...]\r\n```\r\n\r\nThis updates the method to dedupe them.","created_at":"2016-05-12T17:03:13Z","updated_at":"2016-05-13T14:03:38Z","closed_at":"2016-05-13T14:03:38Z","merged_at":"2016-05-13T14:03:38Z","merge_commit_sha":"bf40156909742583b5cf0e5d221eaceddbab32d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/whitehall/pulls/2590/commits","review_comments_url":"https://api.github.com/repos/alphagov/whitehall/pulls/2590/comments","review_comment_url":"https://api.github.com/repos/alphagov/whitehall/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/whitehall/issues/2590/comments","statuses_url":"https://api.github.com/repos/alphagov/whitehall/statuses/867f52b905ade8dec89cc96464b8739ec8b102e4","head":{"label":"alphagov:detailed-guide-dedupe-related-guide-ids","ref":"detailed-guide-dedupe-related-guide-ids","sha":"867f52b905ade8dec89cc96464b8739ec8b102e4","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":2416064,"name":"whitehall","full_name":"alphagov/whitehall","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/whitehall","description":"Inside Government: how the UK Government works, what it's doing, and how you can get involved.","fork":false,"url":"https://api.github.com/repos/alphagov/whitehall","forks_url":"https://api.github.com/repos/alphagov/whitehall/forks","keys_url":"https://api.github.com/repos/alphagov/whitehall/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/whitehall/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/whitehall/teams","hooks_url":"https://api.github.com/repos/alphagov/whitehall/hooks","issue_events_url":"https://api.github.com/repos/alphagov/whitehall/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/whitehall/events","assignees_url":"https://api.github.com/repos/alphagov/whitehall/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/whitehall/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/whitehall/tags","blobs_url":"https://api.github.com/repos/alphagov/whitehall/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/whitehall/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/whitehall/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/whitehall/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/whitehall/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/whitehall/languages","stargazers_url":"https://api.github.com/repos/alphagov/whitehall/stargazers","contributors_url":"https://api.github.com/repos/alphagov/whitehall/contributors","subscribers_url":"https://api.github.com/repos/alphagov/whitehall/subscribers","subscription_url":"https://api.github.com/repos/alphagov/whitehall/subscription","commits_url":"https://api.github.com/repos/alphagov/whitehall/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/whitehall/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/whitehall/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/whitehall/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/whitehall/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/whitehall/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/whitehall/merges","archive_url":"https://api.github.com/repos/alphagov/whitehall/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/whitehall/downloads","issues_url":"https://api.github.com/repos/alphagov/whitehall/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/whitehall/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/whitehall/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/whitehall/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/whitehall/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/whitehall/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/whitehall/deployments","created_at":"2011-09-19T15:10:49Z","updated_at":"2016-05-11T23:46:44Z","pushed_at":"2016-05-13T14:03:38Z","git_url":"git://github.com/alphagov/whitehall.git","ssh_url":"git@github.com:alphagov/whitehall.git","clone_url":"https://github.com/alphagov/whitehall.git","svn_url":"https://github.com/alphagov/whitehall","homepage":"https://www.gov.uk/government/","size":249340,"stargazers_count":342,"watchers_count":342,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":139,"mirror_url":null,"open_issues_count":3,"forks":139,"open_issues":3,"watchers":342,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"91707fdfbb701ec15c68d7cb706d5da00652a5ce","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":2416064,"name":"whitehall","full_name":"alphagov/whitehall","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/whitehall","description":"Inside Government: how the UK Government works, what it's doing, and how you can get involved.","fork":false,"url":"https://api.github.com/repos/alphagov/whitehall","forks_url":"https://api.github.com/repos/alphagov/whitehall/forks","keys_url":"https://api.github.com/repos/alphagov/whitehall/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/whitehall/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/whitehall/teams","hooks_url":"https://api.github.com/repos/alphagov/whitehall/hooks","issue_events_url":"https://api.github.com/repos/alphagov/whitehall/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/whitehall/events","assignees_url":"https://api.github.com/repos/alphagov/whitehall/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/whitehall/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/whitehall/tags","blobs_url":"https://api.github.com/repos/alphagov/whitehall/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/whitehall/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/whitehall/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/whitehall/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/whitehall/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/whitehall/languages","stargazers_url":"https://api.github.com/repos/alphagov/whitehall/stargazers","contributors_url":"https://api.github.com/repos/alphagov/whitehall/contributors","subscribers_url":"https://api.github.com/repos/alphagov/whitehall/subscribers","subscription_url":"https://api.github.com/repos/alphagov/whitehall/subscription","commits_url":"https://api.github.com/repos/alphagov/whitehall/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/whitehall/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/whitehall/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/whitehall/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/whitehall/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/whitehall/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/whitehall/merges","archive_url":"https://api.github.com/repos/alphagov/whitehall/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/whitehall/downloads","issues_url":"https://api.github.com/repos/alphagov/whitehall/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/whitehall/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/whitehall/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/whitehall/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/whitehall/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/whitehall/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/whitehall/deployments","created_at":"2011-09-19T15:10:49Z","updated_at":"2016-05-11T23:46:44Z","pushed_at":"2016-05-13T14:03:38Z","git_url":"git://github.com/alphagov/whitehall.git","ssh_url":"git@github.com:alphagov/whitehall.git","clone_url":"https://github.com/alphagov/whitehall.git","svn_url":"https://github.com/alphagov/whitehall","homepage":"https://www.gov.uk/government/","size":249340,"stargazers_count":342,"watchers_count":342,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":139,"mirror_url":null,"open_issues_count":3,"forks":139,"open_issues":3,"watchers":342,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/whitehall/pulls/2590"},"html":{"href":"https://github.com/alphagov/whitehall/pull/2590"},"issue":{"href":"https://api.github.com/repos/alphagov/whitehall/issues/2590"},"comments":{"href":"https://api.github.com/repos/alphagov/whitehall/issues/2590/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/whitehall/pulls/2590/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/whitehall/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/whitehall/pulls/2590/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/whitehall/statuses/867f52b905ade8dec89cc96464b8739ec8b102e4"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"tvararu","id":1650875,"avatar_url":"https://avatars.githubusercontent.com/u/1650875?v=3","gravatar_id":"","url":"https://api.github.com/users/tvararu","html_url":"https://github.com/tvararu","followers_url":"https://api.github.com/users/tvararu/followers","following_url":"https://api.github.com/users/tvararu/following{/other_user}","gists_url":"https://api.github.com/users/tvararu/gists{/gist_id}","starred_url":"https://api.github.com/users/tvararu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvararu/subscriptions","organizations_url":"https://api.github.com/users/tvararu/orgs","repos_url":"https://api.github.com/users/tvararu/repos","events_url":"https://api.github.com/users/tvararu/events{/privacy}","received_events_url":"https://api.github.com/users/tvararu/received_events","type":"User","site_admin":false},"comments":3,"review_comments":2,"commits":1,"additions":1,"deletions":1,"changed_files":1}}