{"action":"created","comment":{"url":"https://api.github.com/repos/coinfi/coinfi/pulls/comments/216614739","pull_request_review_id":154134057,"id":216614739,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjYxNDczOQ==","diff_hunk":"@@ -0,0 +1,52 @@\n+namespace :data_migrations do\n+  desc 'Consolidate NewsCategories into shorter list'\n+  task :consolidate_news_categories => :environment do\n+    ActiveRecord::Base.transaction do\n+      # Rename category from 'Exchange Listing' to 'Exchange Announcements'\n+      exchange_listing_category = NewsCategory.find_by!(name: 'Exchange Listing')\n+      exchange_listing_category.update!(name: 'Exchange Announcements')\n+      puts \"Renamed NewsCategory(#{exchange_listing_category.id}): 'Exchange Announcements'\"\n+\n+      # Create new 'Price Analysis' category\n+      price_analysis_category = NewsCategory.create!(name: 'Price Analysis')\n+      puts \"Created NewsCategory(#{price_analysis_category.id}): 'Price Analysis'\"\n+\n+      # Create new 'Project Announcements' category\n+      project_announcements_category = NewsCategory.create!(name: 'Project Announcements')\n+      puts \"Created NewsCategory(#{project_announcements_category.id}): 'Project Announcements'\"\n+\n+      # Replace many categorizations with 'Project Announcements'\n+      PROJECT_ANNOUNCEMENTS_CATEGORIES = [\n+        'Partnerships',\n+        'Security (Vulnerabilities)',\n+        'Fundraising',\n+        'Founder News',\n+        'Conferences & Events',\n+        'Airdrops',\n+        'Product Release',\n+        'Forks',\n+        'Adoption',\n+        'Token Supply Changes',\n+      ]\n+      project_announcements_categorizations = NewsItemCategorization\n+        .joins(:news_category)\n+        .where(news_categories: {name: PROJECT_ANNOUNCEMENTS_CATEGORIES})\n+\n+      update_count = 0\n+      project_announcements_categorizations.each do |categorization|\n+        categorization.update!(news_category: project_announcements_category)\n+        update_count += 1\n+      end\n+      puts \"Updated #{update_count} NewsItemCategorization records\"\n+\n+      # Remove replaced categories\n+      replaced_categories = PROJECT_ANNOUNCEMENTS_CATEGORIES\n+      destroy_count = 0\n+      NewsCategory.where(name: replaced_categories).each do |category|","path":"lib/tasks/data_migrations/04_consolidate_news_categories.rake","position":45,"original_position":45,"commit_id":"62019ed046c31c9da8fbf8c41c5dd72fb89fafd9","original_commit_id":"62019ed046c31c9da8fbf8c41c5dd72fb89fafd9","user":{"login":"hanchang","id":637370,"node_id":"MDQ6VXNlcjYzNzM3MA==","avatar_url":"https://avatars1.githubusercontent.com/u/637370?v=4","gravatar_id":"","url":"https://api.github.com/users/hanchang","html_url":"https://github.com/hanchang","followers_url":"https://api.github.com/users/hanchang/followers","following_url":"https://api.github.com/users/hanchang/following{/other_user}","gists_url":"https://api.github.com/users/hanchang/gists{/gist_id}","starred_url":"https://api.github.com/users/hanchang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanchang/subscriptions","organizations_url":"https://api.github.com/users/hanchang/orgs","repos_url":"https://api.github.com/users/hanchang/repos","events_url":"https://api.github.com/users/hanchang/events{/privacy}","received_events_url":"https://api.github.com/users/hanchang/received_events","type":"User","site_admin":false},"body":"This is probably fine since there aren't that many `NewsCategories` anyways.","created_at":"2018-09-11T10:06:26Z","updated_at":"2018-09-11T10:06:26Z","html_url":"https://github.com/coinfi/coinfi/pull/391#discussion_r216614739","pull_request_url":"https://api.github.com/repos/coinfi/coinfi/pulls/391","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/coinfi/coinfi/pulls/comments/216614739"},"html":{"href":"https://github.com/coinfi/coinfi/pull/391#discussion_r216614739"},"pull_request":{"href":"https://api.github.com/repos/coinfi/coinfi/pulls/391"}}},"pull_request":{"url":"https://api.github.com/repos/coinfi/coinfi/pulls/391","id":214185799,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MTg1Nzk5","html_url":"https://github.com/coinfi/coinfi/pull/391","diff_url":"https://github.com/coinfi/coinfi/pull/391.diff","patch_url":"https://github.com/coinfi/coinfi/pull/391.patch","issue_url":"https://api.github.com/repos/coinfi/coinfi/issues/391","number":391,"state":"open","locked":false,"title":"[WIP] Consolidate news categories #798338880309897","user":{"login":"jessehon","id":7012645,"node_id":"MDQ6VXNlcjcwMTI2NDU=","avatar_url":"https://avatars2.githubusercontent.com/u/7012645?v=4","gravatar_id":"","url":"https://api.github.com/users/jessehon","html_url":"https://github.com/jessehon","followers_url":"https://api.github.com/users/jessehon/followers","following_url":"https://api.github.com/users/jessehon/following{/other_user}","gists_url":"https://api.github.com/users/jessehon/gists{/gist_id}","starred_url":"https://api.github.com/users/jessehon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessehon/subscriptions","organizations_url":"https://api.github.com/users/jessehon/orgs","repos_url":"https://api.github.com/users/jessehon/repos","events_url":"https://api.github.com/users/jessehon/events{/privacy}","received_events_url":"https://api.github.com/users/jessehon/received_events","type":"User","site_admin":false},"body":"https://app.asana.com/0/683768070860536/798338880309897/f","created_at":"2018-09-10T02:51:53Z","updated_at":"2018-09-11T10:06:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08213cbb54fa4804433138b265bde62d961349f7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/coinfi/coinfi/pulls/391/commits","review_comments_url":"https://api.github.com/repos/coinfi/coinfi/pulls/391/comments","review_comment_url":"https://api.github.com/repos/coinfi/coinfi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coinfi/coinfi/issues/391/comments","statuses_url":"https://api.github.com/repos/coinfi/coinfi/statuses/62019ed046c31c9da8fbf8c41c5dd72fb89fafd9","head":{"label":"coinfi:feature/considate-news-categories/798338880309897","ref":"feature/considate-news-categories/798338880309897","sha":"62019ed046c31c9da8fbf8c41c5dd72fb89fafd9","user":{"login":"coinfi","id":31571310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNTcxMzEw","avatar_url":"https://avatars3.githubusercontent.com/u/31571310?v=4","gravatar_id":"","url":"https://api.github.com/users/coinfi","html_url":"https://github.com/coinfi","followers_url":"https://api.github.com/users/coinfi/followers","following_url":"https://api.github.com/users/coinfi/following{/other_user}","gists_url":"https://api.github.com/users/coinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/coinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coinfi/subscriptions","organizations_url":"https://api.github.com/users/coinfi/orgs","repos_url":"https://api.github.com/users/coinfi/repos","events_url":"https://api.github.com/users/coinfi/events{/privacy}","received_events_url":"https://api.github.com/users/coinfi/received_events","type":"Organization","site_admin":false},"repo":{"id":102046959,"node_id":"MDEwOlJlcG9zaXRvcnkxMDIwNDY5NTk=","name":"coinfi","full_name":"coinfi/coinfi","owner":{"login":"coinfi","id":31571310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNTcxMzEw","avatar_url":"https://avatars3.githubusercontent.com/u/31571310?v=4","gravatar_id":"","url":"https://api.github.com/users/coinfi","html_url":"https://github.com/coinfi","followers_url":"https://api.github.com/users/coinfi/followers","following_url":"https://api.github.com/users/coinfi/following{/other_user}","gists_url":"https://api.github.com/users/coinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/coinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coinfi/subscriptions","organizations_url":"https://api.github.com/users/coinfi/orgs","repos_url":"https://api.github.com/users/coinfi/repos","events_url":"https://api.github.com/users/coinfi/events{/privacy}","received_events_url":"https://api.github.com/users/coinfi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coinfi/coinfi","description":"CoinFi is the cryptocurrency market intelligence platform.","fork":false,"url":"https://api.github.com/repos/coinfi/coinfi","forks_url":"https://api.github.com/repos/coinfi/coinfi/forks","keys_url":"https://api.github.com/repos/coinfi/coinfi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coinfi/coinfi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coinfi/coinfi/teams","hooks_url":"https://api.github.com/repos/coinfi/coinfi/hooks","issue_events_url":"https://api.github.com/repos/coinfi/coinfi/issues/events{/number}","events_url":"https://api.github.com/repos/coinfi/coinfi/events","assignees_url":"https://api.github.com/repos/coinfi/coinfi/assignees{/user}","branches_url":"https://api.github.com/repos/coinfi/coinfi/branches{/branch}","tags_url":"https://api.github.com/repos/coinfi/coinfi/tags","blobs_url":"https://api.github.com/repos/coinfi/coinfi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coinfi/coinfi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coinfi/coinfi/git/refs{/sha}","trees_url":"https://api.github.com/repos/coinfi/coinfi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coinfi/coinfi/statuses/{sha}","languages_url":"https://api.github.com/repos/coinfi/coinfi/languages","stargazers_url":"https://api.github.com/repos/coinfi/coinfi/stargazers","contributors_url":"https://api.github.com/repos/coinfi/coinfi/contributors","subscribers_url":"https://api.github.com/repos/coinfi/coinfi/subscribers","subscription_url":"https://api.github.com/repos/coinfi/coinfi/subscription","commits_url":"https://api.github.com/repos/coinfi/coinfi/commits{/sha}","git_commits_url":"https://api.github.com/repos/coinfi/coinfi/git/commits{/sha}","comments_url":"https://api.github.com/repos/coinfi/coinfi/comments{/number}","issue_comment_url":"https://api.github.com/repos/coinfi/coinfi/issues/comments{/number}","contents_url":"https://api.github.com/repos/coinfi/coinfi/contents/{+path}","compare_url":"https://api.github.com/repos/coinfi/coinfi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coinfi/coinfi/merges","archive_url":"https://api.github.com/repos/coinfi/coinfi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coinfi/coinfi/downloads","issues_url":"https://api.github.com/repos/coinfi/coinfi/issues{/number}","pulls_url":"https://api.github.com/repos/coinfi/coinfi/pulls{/number}","milestones_url":"https://api.github.com/repos/coinfi/coinfi/milestones{/number}","notifications_url":"https://api.github.com/repos/coinfi/coinfi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coinfi/coinfi/labels{/name}","releases_url":"https://api.github.com/repos/coinfi/coinfi/releases{/id}","deployments_url":"https://api.github.com/repos/coinfi/coinfi/deployments","created_at":"2017-08-31T21:28:02Z","updated_at":"2018-09-11T06:28:55Z","pushed_at":"2018-09-11T07:18:37Z","git_url":"git://github.com/coinfi/coinfi.git","ssh_url":"git@github.com:coinfi/coinfi.git","clone_url":"https://github.com/coinfi/coinfi.git","svn_url":"https://github.com/coinfi/coinfi","homepage":"https://www.coinfi.com","size":128654,"stargazers_count":46,"watchers_count":46,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":15,"open_issues":7,"watchers":46,"default_branch":"develop"}},"base":{"label":"coinfi:develop","ref":"develop","sha":"a7f6444cf0de493a15df769f2465da081845040a","user":{"login":"coinfi","id":31571310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNTcxMzEw","avatar_url":"https://avatars3.githubusercontent.com/u/31571310?v=4","gravatar_id":"","url":"https://api.github.com/users/coinfi","html_url":"https://github.com/coinfi","followers_url":"https://api.github.com/users/coinfi/followers","following_url":"https://api.github.com/users/coinfi/following{/other_user}","gists_url":"https://api.github.com/users/coinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/coinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coinfi/subscriptions","organizations_url":"https://api.github.com/users/coinfi/orgs","repos_url":"https://api.github.com/users/coinfi/repos","events_url":"https://api.github.com/users/coinfi/events{/privacy}","received_events_url":"https://api.github.com/users/coinfi/received_events","type":"Organization","site_admin":false},"repo":{"id":102046959,"node_id":"MDEwOlJlcG9zaXRvcnkxMDIwNDY5NTk=","name":"coinfi","full_name":"coinfi/coinfi","owner":{"login":"coinfi","id":31571310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNTcxMzEw","avatar_url":"https://avatars3.githubusercontent.com/u/31571310?v=4","gravatar_id":"","url":"https://api.github.com/users/coinfi","html_url":"https://github.com/coinfi","followers_url":"https://api.github.com/users/coinfi/followers","following_url":"https://api.github.com/users/coinfi/following{/other_user}","gists_url":"https://api.github.com/users/coinfi/gists{/gist_id}","starred_url":"https://api.github.com/users/coinfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coinfi/subscriptions","organizations_url":"https://api.github.com/users/coinfi/orgs","repos_url":"https://api.github.com/users/coinfi/repos","events_url":"https://api.github.com/users/coinfi/events{/privacy}","received_events_url":"https://api.github.com/users/coinfi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coinfi/coinfi","description":"CoinFi is the cryptocurrency market intelligence platform.","fork":false,"url":"https://api.github.com/repos/coinfi/coinfi","forks_url":"https://api.github.com/repos/coinfi/coinfi/forks","keys_url":"https://api.github.com/repos/coinfi/coinfi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coinfi/coinfi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coinfi/coinfi/teams","hooks_url":"https://api.github.com/repos/coinfi/coinfi/hooks","issue_events_url":"https://api.github.com/repos/coinfi/coinfi/issues/events{/number}","events_url":"https://api.github.com/repos/coinfi/coinfi/events","assignees_url":"https://api.github.com/repos/coinfi/coinfi/assignees{/user}","branches_url":"https://api.github.com/repos/coinfi/coinfi/branches{/branch}","tags_url":"https://api.github.com/repos/coinfi/coinfi/tags","blobs_url":"https://api.github.com/repos/coinfi/coinfi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coinfi/coinfi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coinfi/coinfi/git/refs{/sha}","trees_url":"https://api.github.com/repos/coinfi/coinfi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coinfi/coinfi/statuses/{sha}","languages_url":"https://api.github.com/repos/coinfi/coinfi/languages","stargazers_url":"https://api.github.com/repos/coinfi/coinfi/stargazers","contributors_url":"https://api.github.com/repos/coinfi/coinfi/contributors","subscribers_url":"https://api.github.com/repos/coinfi/coinfi/subscribers","subscription_url":"https://api.github.com/repos/coinfi/coinfi/subscription","commits_url":"https://api.github.com/repos/coinfi/coinfi/commits{/sha}","git_commits_url":"https://api.github.com/repos/coinfi/coinfi/git/commits{/sha}","comments_url":"https://api.github.com/repos/coinfi/coinfi/comments{/number}","issue_comment_url":"https://api.github.com/repos/coinfi/coinfi/issues/comments{/number}","contents_url":"https://api.github.com/repos/coinfi/coinfi/contents/{+path}","compare_url":"https://api.github.com/repos/coinfi/coinfi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coinfi/coinfi/merges","archive_url":"https://api.github.com/repos/coinfi/coinfi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coinfi/coinfi/downloads","issues_url":"https://api.github.com/repos/coinfi/coinfi/issues{/number}","pulls_url":"https://api.github.com/repos/coinfi/coinfi/pulls{/number}","milestones_url":"https://api.github.com/repos/coinfi/coinfi/milestones{/number}","notifications_url":"https://api.github.com/repos/coinfi/coinfi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coinfi/coinfi/labels{/name}","releases_url":"https://api.github.com/repos/coinfi/coinfi/releases{/id}","deployments_url":"https://api.github.com/repos/coinfi/coinfi/deployments","created_at":"2017-08-31T21:28:02Z","updated_at":"2018-09-11T06:28:55Z","pushed_at":"2018-09-11T07:18:37Z","git_url":"git://github.com/coinfi/coinfi.git","ssh_url":"git@github.com:coinfi/coinfi.git","clone_url":"https://github.com/coinfi/coinfi.git","svn_url":"https://github.com/coinfi/coinfi","homepage":"https://www.coinfi.com","size":128654,"stargazers_count":46,"watchers_count":46,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":15,"open_issues":7,"watchers":46,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/coinfi/coinfi/pulls/391"},"html":{"href":"https://github.com/coinfi/coinfi/pull/391"},"issue":{"href":"https://api.github.com/repos/coinfi/coinfi/issues/391"},"comments":{"href":"https://api.github.com/repos/coinfi/coinfi/issues/391/comments"},"review_comments":{"href":"https://api.github.com/repos/coinfi/coinfi/pulls/391/comments"},"review_comment":{"href":"https://api.github.com/repos/coinfi/coinfi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coinfi/coinfi/pulls/391/commits"},"statuses":{"href":"https://api.github.com/repos/coinfi/coinfi/statuses/62019ed046c31c9da8fbf8c41c5dd72fb89fafd9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hanchang"}}