{"action":"created","comment":{"url":"https://api.github.com/repos/dchbx/enroll/pulls/comments/282906144","pull_request_review_id":236134086,"id":282906144,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4MjkwNjE0NA==","diff_hunk":"@@ -1017,6 +1088,145 @@ def generate_family_search\n     ::MapReduce::FamilySearchForFamily.populate_for(self)\n   end\n \n+  #Used for RelationshipMatrix\n+  def build_relationship_matrix\n+    family_id = self.id\n+    family_members_id = family_members.where(is_active: true).map(&:person_id)\n+    matrix_size = family_members.where(is_active: true).count\n+    matrix = Array.new(matrix_size){Array.new(matrix_size)}\n+    id_map = {}\n+    family_members_id.each_with_index { |hmid, index| id_map.merge!(index => hmid ) }\n+    matrix.each_with_index do |x, xi|\n+      x.each_with_index do |y, yi|\n+        matrix[xi][yi] = find_existing_relationship(id_map[xi], id_map[yi], family_id)\n+        matrix[yi][xi] = find_existing_relationship(id_map[yi], id_map[xi], family_id)\n+      end\n+    end\n+    matrix = apply_rules_and_update_relationships(matrix, family_id)\n+    return matrix\n+  end\n+\n+  def find_existing_relationship(member_a_id, member_b_id, family_id)\n+    return \"self\" if member_a_id == member_b_id\n+    person = Person.find(member_a_id)\n+    rel = person.person_relationships.where(family_id: family_id, predecessor_id: member_a_id, successor_id: member_b_id).first\n+    return rel.kind if rel.present?\n+  end\n+\n+  def find_all_relationships(matrix)\n+    id_map = {}\n+    family_members_id = family_members.where(is_active: true).map(&:person_id)\n+    family_members_id.each_with_index { |hmid, index| id_map.merge!(index => hmid ) }\n+    all_relationships = []\n+    matrix.each_with_index do |x, xi|\n+      x.each_with_index do |y, yi|\n+        if (xi < yi)\n+          relation = Person.find(id_map[xi]).person_relationships.where(family_id: self.id, predecessor_id: id_map[xi], successor_id: id_map[yi]).first","path":"app/models/family.rb","position":176,"original_position":176,"commit_id":"8b6c8f0362e27eedb69798bff3021d562c3baab0","original_commit_id":"8b6c8f0362e27eedb69798bff3021d562c3baab0","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Style/RedundantSelf: Redundant self detected.","created_at":"2019-05-10T14:24:24Z","updated_at":"2019-05-10T14:24:25Z","html_url":"https://github.com/dchbx/enroll/pull/2660#discussion_r282906144","pull_request_url":"https://api.github.com/repos/dchbx/enroll/pulls/2660","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/dchbx/enroll/pulls/comments/282906144"},"html":{"href":"https://github.com/dchbx/enroll/pull/2660#discussion_r282906144"},"pull_request":{"href":"https://api.github.com/repos/dchbx/enroll/pulls/2660"}}},"pull_request":{"url":"https://api.github.com/repos/dchbx/enroll/pulls/2660","id":268805222,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY4ODA1MjIy","html_url":"https://github.com/dchbx/enroll/pull/2660","diff_url":"https://github.com/dchbx/enroll/pull/2660.diff","patch_url":"https://github.com/dchbx/enroll/pull/2660.patch","issue_url":"https://api.github.com/repos/dchbx/enroll/issues/2660","number":2660,"state":"open","locked":false,"title":"Faa feature base","user":{"login":"maheshkurma","id":20909776,"node_id":"MDQ6VXNlcjIwOTA5Nzc2","avatar_url":"https://avatars0.githubusercontent.com/u/20909776?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshkurma","html_url":"https://github.com/maheshkurma","followers_url":"https://api.github.com/users/maheshkurma/followers","following_url":"https://api.github.com/users/maheshkurma/following{/other_user}","gists_url":"https://api.github.com/users/maheshkurma/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshkurma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshkurma/subscriptions","organizations_url":"https://api.github.com/users/maheshkurma/orgs","repos_url":"https://api.github.com/users/maheshkurma/repos","events_url":"https://api.github.com/users/maheshkurma/events{/privacy}","received_events_url":"https://api.github.com/users/maheshkurma/received_events","type":"User","site_admin":false},"body":"### Master Redmine ticket\r\n* (Required!)\r\n\r\n### Child Redmine ticket(s)\r\n* ()\r\n* ()\r\n\r\n### Local build result\r\n\r\n```\r\nbundle exec rake parallel:spec[4]\r\nbundle exec cucumber\r\n```\r\n\r\n### Latest rebase/merge tag\r\n*\r\n\r\n---\r\n\r\n### Data ticket(s) Followup\r\n* (redmine links here - optional)\r\n\r\n### Related Pull Requests\r\n* (github links here - optional)\r\n\r\n---\r\n\r\n### TODOs / Notes\r\n#### Peer Review\r\n* (For code review)\r\n\r\n#### Functional Testing\r\n* (For testing locally)\r\n\r\n#### Deployment\r\n* (for release manager and/or build manager)\r\n","created_at":"2019-04-09T16:05:54Z","updated_at":"2019-05-10T14:24:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f541b1633988c7e786452871c4bd8c526eb07aab","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dchbx/enroll/pulls/2660/commits","review_comments_url":"https://api.github.com/repos/dchbx/enroll/pulls/2660/comments","review_comment_url":"https://api.github.com/repos/dchbx/enroll/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dchbx/enroll/issues/2660/comments","statuses_url":"https://api.github.com/repos/dchbx/enroll/statuses/8b6c8f0362e27eedb69798bff3021d562c3baab0","head":{"label":"dchbx:faa-feature-base","ref":"faa-feature-base","sha":"8b6c8f0362e27eedb69798bff3021d562c3baab0","user":{"login":"dchbx","id":4580217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1ODAyMTc=","avatar_url":"https://avatars1.githubusercontent.com/u/4580217?v=4","gravatar_id":"","url":"https://api.github.com/users/dchbx","html_url":"https://github.com/dchbx","followers_url":"https://api.github.com/users/dchbx/followers","following_url":"https://api.github.com/users/dchbx/following{/other_user}","gists_url":"https://api.github.com/users/dchbx/gists{/gist_id}","starred_url":"https://api.github.com/users/dchbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchbx/subscriptions","organizations_url":"https://api.github.com/users/dchbx/orgs","repos_url":"https://api.github.com/users/dchbx/repos","events_url":"https://api.github.com/users/dchbx/events{/privacy}","received_events_url":"https://api.github.com/users/dchbx/received_events","type":"Organization","site_admin":false},"repo":{"id":28518679,"node_id":"MDEwOlJlcG9zaXRvcnkyODUxODY3OQ==","name":"enroll","full_name":"dchbx/enroll","private":false,"owner":{"login":"dchbx","id":4580217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1ODAyMTc=","avatar_url":"https://avatars1.githubusercontent.com/u/4580217?v=4","gravatar_id":"","url":"https://api.github.com/users/dchbx","html_url":"https://github.com/dchbx","followers_url":"https://api.github.com/users/dchbx/followers","following_url":"https://api.github.com/users/dchbx/following{/other_user}","gists_url":"https://api.github.com/users/dchbx/gists{/gist_id}","starred_url":"https://api.github.com/users/dchbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchbx/subscriptions","organizations_url":"https://api.github.com/users/dchbx/orgs","repos_url":"https://api.github.com/users/dchbx/repos","events_url":"https://api.github.com/users/dchbx/events{/privacy}","received_events_url":"https://api.github.com/users/dchbx/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dchbx/enroll","description":"An ACA-compliant enrollment system for individual and SHOP markets, built on Ruby on Rails, with a Mongo database","fork":false,"url":"https://api.github.com/repos/dchbx/enroll","forks_url":"https://api.github.com/repos/dchbx/enroll/forks","keys_url":"https://api.github.com/repos/dchbx/enroll/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dchbx/enroll/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dchbx/enroll/teams","hooks_url":"https://api.github.com/repos/dchbx/enroll/hooks","issue_events_url":"https://api.github.com/repos/dchbx/enroll/issues/events{/number}","events_url":"https://api.github.com/repos/dchbx/enroll/events","assignees_url":"https://api.github.com/repos/dchbx/enroll/assignees{/user}","branches_url":"https://api.github.com/repos/dchbx/enroll/branches{/branch}","tags_url":"https://api.github.com/repos/dchbx/enroll/tags","blobs_url":"https://api.github.com/repos/dchbx/enroll/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dchbx/enroll/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dchbx/enroll/git/refs{/sha}","trees_url":"https://api.github.com/repos/dchbx/enroll/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dchbx/enroll/statuses/{sha}","languages_url":"https://api.github.com/repos/dchbx/enroll/languages","stargazers_url":"https://api.github.com/repos/dchbx/enroll/stargazers","contributors_url":"https://api.github.com/repos/dchbx/enroll/contributors","subscribers_url":"https://api.github.com/repos/dchbx/enroll/subscribers","subscription_url":"https://api.github.com/repos/dchbx/enroll/subscription","commits_url":"https://api.github.com/repos/dchbx/enroll/commits{/sha}","git_commits_url":"https://api.github.com/repos/dchbx/enroll/git/commits{/sha}","comments_url":"https://api.github.com/repos/dchbx/enroll/comments{/number}","issue_comment_url":"https://api.github.com/repos/dchbx/enroll/issues/comments{/number}","contents_url":"https://api.github.com/repos/dchbx/enroll/contents/{+path}","compare_url":"https://api.github.com/repos/dchbx/enroll/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dchbx/enroll/merges","archive_url":"https://api.github.com/repos/dchbx/enroll/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dchbx/enroll/downloads","issues_url":"https://api.github.com/repos/dchbx/enroll/issues{/number}","pulls_url":"https://api.github.com/repos/dchbx/enroll/pulls{/number}","milestones_url":"https://api.github.com/repos/dchbx/enroll/milestones{/number}","notifications_url":"https://api.github.com/repos/dchbx/enroll/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dchbx/enroll/labels{/name}","releases_url":"https://api.github.com/repos/dchbx/enroll/releases{/id}","deployments_url":"https://api.github.com/repos/dchbx/enroll/deployments","created_at":"2014-12-26T18:59:14Z","updated_at":"2019-05-09T18:59:04Z","pushed_at":"2019-05-10T14:23:43Z","git_url":"git://github.com/dchbx/enroll.git","ssh_url":"git@github.com:dchbx/enroll.git","clone_url":"https://github.com/dchbx/enroll.git","svn_url":"https://github.com/dchbx/enroll","homepage":"https://dchealthlink.com/","size":164017,"stargazers_count":20,"watchers_count":20,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":395,"license":null,"forks":30,"open_issues":395,"watchers":20,"default_branch":"master"}},"base":{"label":"dchbx:master","ref":"master","sha":"7663a1a529b02956824920d685ea5b6eb839b0d5","user":{"login":"dchbx","id":4580217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1ODAyMTc=","avatar_url":"https://avatars1.githubusercontent.com/u/4580217?v=4","gravatar_id":"","url":"https://api.github.com/users/dchbx","html_url":"https://github.com/dchbx","followers_url":"https://api.github.com/users/dchbx/followers","following_url":"https://api.github.com/users/dchbx/following{/other_user}","gists_url":"https://api.github.com/users/dchbx/gists{/gist_id}","starred_url":"https://api.github.com/users/dchbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchbx/subscriptions","organizations_url":"https://api.github.com/users/dchbx/orgs","repos_url":"https://api.github.com/users/dchbx/repos","events_url":"https://api.github.com/users/dchbx/events{/privacy}","received_events_url":"https://api.github.com/users/dchbx/received_events","type":"Organization","site_admin":false},"repo":{"id":28518679,"node_id":"MDEwOlJlcG9zaXRvcnkyODUxODY3OQ==","name":"enroll","full_name":"dchbx/enroll","private":false,"owner":{"login":"dchbx","id":4580217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ1ODAyMTc=","avatar_url":"https://avatars1.githubusercontent.com/u/4580217?v=4","gravatar_id":"","url":"https://api.github.com/users/dchbx","html_url":"https://github.com/dchbx","followers_url":"https://api.github.com/users/dchbx/followers","following_url":"https://api.github.com/users/dchbx/following{/other_user}","gists_url":"https://api.github.com/users/dchbx/gists{/gist_id}","starred_url":"https://api.github.com/users/dchbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchbx/subscriptions","organizations_url":"https://api.github.com/users/dchbx/orgs","repos_url":"https://api.github.com/users/dchbx/repos","events_url":"https://api.github.com/users/dchbx/events{/privacy}","received_events_url":"https://api.github.com/users/dchbx/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dchbx/enroll","description":"An ACA-compliant enrollment system for individual and SHOP markets, built on Ruby on Rails, with a Mongo database","fork":false,"url":"https://api.github.com/repos/dchbx/enroll","forks_url":"https://api.github.com/repos/dchbx/enroll/forks","keys_url":"https://api.github.com/repos/dchbx/enroll/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dchbx/enroll/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dchbx/enroll/teams","hooks_url":"https://api.github.com/repos/dchbx/enroll/hooks","issue_events_url":"https://api.github.com/repos/dchbx/enroll/issues/events{/number}","events_url":"https://api.github.com/repos/dchbx/enroll/events","assignees_url":"https://api.github.com/repos/dchbx/enroll/assignees{/user}","branches_url":"https://api.github.com/repos/dchbx/enroll/branches{/branch}","tags_url":"https://api.github.com/repos/dchbx/enroll/tags","blobs_url":"https://api.github.com/repos/dchbx/enroll/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dchbx/enroll/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dchbx/enroll/git/refs{/sha}","trees_url":"https://api.github.com/repos/dchbx/enroll/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dchbx/enroll/statuses/{sha}","languages_url":"https://api.github.com/repos/dchbx/enroll/languages","stargazers_url":"https://api.github.com/repos/dchbx/enroll/stargazers","contributors_url":"https://api.github.com/repos/dchbx/enroll/contributors","subscribers_url":"https://api.github.com/repos/dchbx/enroll/subscribers","subscription_url":"https://api.github.com/repos/dchbx/enroll/subscription","commits_url":"https://api.github.com/repos/dchbx/enroll/commits{/sha}","git_commits_url":"https://api.github.com/repos/dchbx/enroll/git/commits{/sha}","comments_url":"https://api.github.com/repos/dchbx/enroll/comments{/number}","issue_comment_url":"https://api.github.com/repos/dchbx/enroll/issues/comments{/number}","contents_url":"https://api.github.com/repos/dchbx/enroll/contents/{+path}","compare_url":"https://api.github.com/repos/dchbx/enroll/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dchbx/enroll/merges","archive_url":"https://api.github.com/repos/dchbx/enroll/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dchbx/enroll/downloads","issues_url":"https://api.github.com/repos/dchbx/enroll/issues{/number}","pulls_url":"https://api.github.com/repos/dchbx/enroll/pulls{/number}","milestones_url":"https://api.github.com/repos/dchbx/enroll/milestones{/number}","notifications_url":"https://api.github.com/repos/dchbx/enroll/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dchbx/enroll/labels{/name}","releases_url":"https://api.github.com/repos/dchbx/enroll/releases{/id}","deployments_url":"https://api.github.com/repos/dchbx/enroll/deployments","created_at":"2014-12-26T18:59:14Z","updated_at":"2019-05-09T18:59:04Z","pushed_at":"2019-05-10T14:23:43Z","git_url":"git://github.com/dchbx/enroll.git","ssh_url":"git@github.com:dchbx/enroll.git","clone_url":"https://github.com/dchbx/enroll.git","svn_url":"https://github.com/dchbx/enroll","homepage":"https://dchealthlink.com/","size":164017,"stargazers_count":20,"watchers_count":20,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":395,"license":null,"forks":30,"open_issues":395,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dchbx/enroll/pulls/2660"},"html":{"href":"https://github.com/dchbx/enroll/pull/2660"},"issue":{"href":"https://api.github.com/repos/dchbx/enroll/issues/2660"},"comments":{"href":"https://api.github.com/repos/dchbx/enroll/issues/2660/comments"},"review_comments":{"href":"https://api.github.com/repos/dchbx/enroll/pulls/2660/comments"},"review_comment":{"href":"https://api.github.com/repos/dchbx/enroll/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dchbx/enroll/pulls/2660/commits"},"statuses":{"href":"https://api.github.com/repos/dchbx/enroll/statuses/8b6c8f0362e27eedb69798bff3021d562c3baab0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}