{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/content-tagger/pulls/comments/79380979","id":79380979,"diff_hunk":"@@ -14,4 +14,25 @@ class TagMigration < ActiveRecord::Base\n   def mark_as_deleted\n     update!(deleted_at: DateTime.current)\n   end\n+\n+  def aggregated_tag_mappings\n+    tag_mappings_grouped_by_content_base_path.reduce([]) do |accumulator, aggregation|\n+      accumulator << AggregatedTagMapping.new(content_base_path: aggregation.first, tag_mappings: aggregation.last)\n+    end\n+  end\n+\n+private\n+\n+  def tag_mappings_grouped_by_content_base_path\n+    tag_mappings.by_state.by_content_base_path.by_link_title\n+      .select(","path":"app/models/tag_migration.rb","position":null,"original_position":15,"commit_id":"98c265f6769727e6f07cacf218d502852591de79","original_commit_id":"e4dc827180fd757f2859e050b9a1166f38a1e7b3","user":{"login":"carvil","id":416701,"avatar_url":"https://avatars.githubusercontent.com/u/416701?v=3","gravatar_id":"","url":"https://api.github.com/users/carvil","html_url":"https://github.com/carvil","followers_url":"https://api.github.com/users/carvil/followers","following_url":"https://api.github.com/users/carvil/following{/other_user}","gists_url":"https://api.github.com/users/carvil/gists{/gist_id}","starred_url":"https://api.github.com/users/carvil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carvil/subscriptions","organizations_url":"https://api.github.com/users/carvil/orgs","repos_url":"https://api.github.com/users/carvil/repos","events_url":"https://api.github.com/users/carvil/events{/privacy}","received_events_url":"https://api.github.com/users/carvil/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2016-09-19T12:39:20Z","updated_at":"2016-09-19T12:39:20Z","html_url":"https://github.com/alphagov/content-tagger/pull/167#discussion_r79380979","pull_request_url":"https://api.github.com/repos/alphagov/content-tagger/pulls/167","_links":{"self":{"href":"https://api.github.com/repos/alphagov/content-tagger/pulls/comments/79380979"},"html":{"href":"https://github.com/alphagov/content-tagger/pull/167#discussion_r79380979"},"pull_request":{"href":"https://api.github.com/repos/alphagov/content-tagger/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/content-tagger/pulls/167","id":85253054,"html_url":"https://github.com/alphagov/content-tagger/pull/167","diff_url":"https://github.com/alphagov/content-tagger/pull/167.diff","patch_url":"https://github.com/alphagov/content-tagger/pull/167.patch","issue_url":"https://api.github.com/repos/alphagov/content-tagger/issues/167","number":167,"state":"open","locked":false,"title":"Consolidate TagMappings by content_base_path","user":{"login":"Davidslv","id":136777,"avatar_url":"https://avatars.githubusercontent.com/u/136777?v=3","gravatar_id":"","url":"https://api.github.com/users/Davidslv","html_url":"https://github.com/Davidslv","followers_url":"https://api.github.com/users/Davidslv/followers","following_url":"https://api.github.com/users/Davidslv/following{/other_user}","gists_url":"https://api.github.com/users/Davidslv/gists{/gist_id}","starred_url":"https://api.github.com/users/Davidslv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Davidslv/subscriptions","organizations_url":"https://api.github.com/users/Davidslv/orgs","repos_url":"https://api.github.com/users/Davidslv/repos","events_url":"https://api.github.com/users/Davidslv/events{/privacy}","received_events_url":"https://api.github.com/users/Davidslv/received_events","type":"User","site_admin":false},"body":"This approach is to consolidate records in order to see them in one row per content item change.\r\n\r\nI would like to receive some feedback on this approach and also make sure that it's not missing anything. I'm not sure if the local data I'm seeing is the whole picture as I seem to only have one `link_type` per content_base_path. \r\n\r\nWill leave the failing specs to be fixed after some discussion.\r\n\r\nTrello: https://trello.com/c/lnE4VdSj\r\n\r\n## Before\r\n\r\n![screen shot 2016-09-14 at 16 12 59](https://cloud.githubusercontent.com/assets/136777/18519047/4f96c598-7a9a-11e6-9d43-7b76cc9d5494.png)\r\n\r\n## After\r\n\r\n![screen shot 2016-09-15 at 16 07 30](https://cloud.githubusercontent.com/assets/136777/18556692/11613342-7b64-11e6-8eda-0e7b92ac73f1.png)\r\n![screen shot 2016-09-15 at 16 06 47](https://cloud.githubusercontent.com/assets/136777/18556693/1178230e-7b64-11e6-9134-4bc4c0879aac.png)\r\n\r\n![screen shot 2016-09-15 at 16 56 15](https://cloud.githubusercontent.com/assets/136777/18557190/df48e4e8-7b65-11e6-8619-e302181ee769.png)\r\n\r\n","created_at":"2016-09-14T15:44:52Z","updated_at":"2016-09-19T12:39:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24dc5c8e549e26db50b31101b12fb048c4f60b5f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/content-tagger/pulls/167/commits","review_comments_url":"https://api.github.com/repos/alphagov/content-tagger/pulls/167/comments","review_comment_url":"https://api.github.com/repos/alphagov/content-tagger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/content-tagger/issues/167/comments","statuses_url":"https://api.github.com/repos/alphagov/content-tagger/statuses/98c265f6769727e6f07cacf218d502852591de79","head":{"label":"alphagov:consolidate-tag-mapping-records","ref":"consolidate-tag-mapping-records","sha":"98c265f6769727e6f07cacf218d502852591de79","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":46417722,"name":"content-tagger","full_name":"alphagov/content-tagger","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/content-tagger","description":"Application for tagging content on GOV.UK","fork":false,"url":"https://api.github.com/repos/alphagov/content-tagger","forks_url":"https://api.github.com/repos/alphagov/content-tagger/forks","keys_url":"https://api.github.com/repos/alphagov/content-tagger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/content-tagger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/content-tagger/teams","hooks_url":"https://api.github.com/repos/alphagov/content-tagger/hooks","issue_events_url":"https://api.github.com/repos/alphagov/content-tagger/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/content-tagger/events","assignees_url":"https://api.github.com/repos/alphagov/content-tagger/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/content-tagger/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/content-tagger/tags","blobs_url":"https://api.github.com/repos/alphagov/content-tagger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/content-tagger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/content-tagger/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/content-tagger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/content-tagger/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/content-tagger/languages","stargazers_url":"https://api.github.com/repos/alphagov/content-tagger/stargazers","contributors_url":"https://api.github.com/repos/alphagov/content-tagger/contributors","subscribers_url":"https://api.github.com/repos/alphagov/content-tagger/subscribers","subscription_url":"https://api.github.com/repos/alphagov/content-tagger/subscription","commits_url":"https://api.github.com/repos/alphagov/content-tagger/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/content-tagger/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/content-tagger/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/content-tagger/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/content-tagger/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/content-tagger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/content-tagger/merges","archive_url":"https://api.github.com/repos/alphagov/content-tagger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/content-tagger/downloads","issues_url":"https://api.github.com/repos/alphagov/content-tagger/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/content-tagger/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/content-tagger/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/content-tagger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/content-tagger/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/content-tagger/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/content-tagger/deployments","created_at":"2015-11-18T12:36:10Z","updated_at":"2016-08-13T09:38:36Z","pushed_at":"2016-09-19T12:38:55Z","git_url":"git://github.com/alphagov/content-tagger.git","ssh_url":"git@github.com:alphagov/content-tagger.git","clone_url":"https://github.com/alphagov/content-tagger.git","svn_url":"https://github.com/alphagov/content-tagger","homepage":"https://content-tagger.publishing.service.gov.uk/","size":2768,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"f8aec7bfb7ec328e8cd95843223e020775c6a7fa","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":46417722,"name":"content-tagger","full_name":"alphagov/content-tagger","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/content-tagger","description":"Application for tagging content on GOV.UK","fork":false,"url":"https://api.github.com/repos/alphagov/content-tagger","forks_url":"https://api.github.com/repos/alphagov/content-tagger/forks","keys_url":"https://api.github.com/repos/alphagov/content-tagger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/content-tagger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/content-tagger/teams","hooks_url":"https://api.github.com/repos/alphagov/content-tagger/hooks","issue_events_url":"https://api.github.com/repos/alphagov/content-tagger/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/content-tagger/events","assignees_url":"https://api.github.com/repos/alphagov/content-tagger/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/content-tagger/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/content-tagger/tags","blobs_url":"https://api.github.com/repos/alphagov/content-tagger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/content-tagger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/content-tagger/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/content-tagger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/content-tagger/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/content-tagger/languages","stargazers_url":"https://api.github.com/repos/alphagov/content-tagger/stargazers","contributors_url":"https://api.github.com/repos/alphagov/content-tagger/contributors","subscribers_url":"https://api.github.com/repos/alphagov/content-tagger/subscribers","subscription_url":"https://api.github.com/repos/alphagov/content-tagger/subscription","commits_url":"https://api.github.com/repos/alphagov/content-tagger/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/content-tagger/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/content-tagger/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/content-tagger/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/content-tagger/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/content-tagger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/content-tagger/merges","archive_url":"https://api.github.com/repos/alphagov/content-tagger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/content-tagger/downloads","issues_url":"https://api.github.com/repos/alphagov/content-tagger/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/content-tagger/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/content-tagger/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/content-tagger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/content-tagger/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/content-tagger/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/content-tagger/deployments","created_at":"2015-11-18T12:36:10Z","updated_at":"2016-08-13T09:38:36Z","pushed_at":"2016-09-19T12:38:55Z","git_url":"git://github.com/alphagov/content-tagger.git","ssh_url":"git@github.com:alphagov/content-tagger.git","clone_url":"https://github.com/alphagov/content-tagger.git","svn_url":"https://github.com/alphagov/content-tagger","homepage":"https://content-tagger.publishing.service.gov.uk/","size":2768,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/content-tagger/pulls/167"},"html":{"href":"https://github.com/alphagov/content-tagger/pull/167"},"issue":{"href":"https://api.github.com/repos/alphagov/content-tagger/issues/167"},"comments":{"href":"https://api.github.com/repos/alphagov/content-tagger/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/content-tagger/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/content-tagger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/content-tagger/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/content-tagger/statuses/98c265f6769727e6f07cacf218d502852591de79"}}}}
{"actor":{"display_login":"carvil"}}