{"action":"created","comment":{"url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/comments/52847110","id":52847110,"diff_hunk":"@@ -0,0 +1,125 @@\n+class LinkedSerials < MarcField\n+  def values\n+    relevant_fields.map do |field|\n+      {\n+        label: subfield_label(field),\n+        values: field.subfields.map do |subfield|\n+                  process_subfield(field, subfield)\n+                end.flatten.compact\n+      }\n+    end\n+  end\n+\n+  def to_partial_path\n+    'marc_fields/linked_serials'\n+  end\n+\n+  private\n+\n+  def process_subfield(field, subfield)\n+    return { text: subfield.value } unless respond_to?(\"#{subfield.code}_subfield\", true)\n+    send(\"#{subfield.code}_subfield\", field, subfield.value)\n+  end\n+\n+  def a_subfield(field, value)\n+    if (title = field_title(field)).present?\n+      { link: \"#{value} #{title}\", href: \"\\\"#{value} #{title}\\\"\", search_field: 'author_title' }\n+    else\n+      { link: value, search_field: 'search' }\n+    end\n+  end\n+\n+  def s_subfield(field, _)\n+    return if field_has_main_entry?(field)\n+    { link: field_title(field), href: \"\\\"#{field_title(field)}\\\"\", search_field: 'search_title' }\n+  end\n+  alias t_subfield s_subfield\n+\n+  def x_subfield(_, value)\n+    [\n+      { text: '(' },\n+      { link: value, search_field: 'isbn_search' },\n+      { text: ')' }\n+    ]\n+  end\n+  alias z_subfield x_subfield\n+\n+  def field_title(field)\n+    field['s'] || field['t']\n+  end\n+\n+  def field_has_main_entry?(field)\n+    field['a'].present?\n+  end\n+\n+  def subfield_label(field)\n+    if merged_with?(field) && field != merged_with_785s.first\n+      if field == merged_with_785s.last\n+        'to form'\n+      else\n+        'and with'\n+      end\n+    else\n+      subfield_labels[field.tag][field.indicator2] || subfield_labels[field.tag]['*']\n+    end\n+  end\n+\n+  def merged_with?(field)\n+    field.tag == '785' && field.indicator2 == '7'\n+  end\n+\n+  def merged_with_785s\n+    @merged_with_785s ||= marc.fields('785').select(&method(:merged_with?))\n+  end\n+\n+  def subfield_labels","path":"app/models/marc_fields/linked_serials.rb","position":75,"original_position":75,"commit_id":"722990bcdc89886d73e3826e1e5274e2dad00f3f","original_commit_id":"722990bcdc89886d73e3826e1e5274e2dad00f3f","user":{"login":"ndushay","id":96775,"avatar_url":"https://avatars.githubusercontent.com/u/96775?v=3","gravatar_id":"","url":"https://api.github.com/users/ndushay","html_url":"https://github.com/ndushay","followers_url":"https://api.github.com/users/ndushay/followers","following_url":"https://api.github.com/users/ndushay/following{/other_user}","gists_url":"https://api.github.com/users/ndushay/gists{/gist_id}","starred_url":"https://api.github.com/users/ndushay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndushay/subscriptions","organizations_url":"https://api.github.com/users/ndushay/orgs","repos_url":"https://api.github.com/users/ndushay/repos","events_url":"https://api.github.com/users/ndushay/events{/privacy}","received_events_url":"https://api.github.com/users/ndushay/received_events","type":"User","site_admin":false},"body":"are these subfield labels or marc field/tag labels?","created_at":"2016-02-14T19:00:55Z","updated_at":"2016-02-14T19:00:55Z","html_url":"https://github.com/sul-dlss/SearchWorks/pull/1204#discussion_r52847110","pull_request_url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204","_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/comments/52847110"},"html":{"href":"https://github.com/sul-dlss/SearchWorks/pull/1204#discussion_r52847110"},"pull_request":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204"}}},"pull_request":{"url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204","id":59249507,"html_url":"https://github.com/sul-dlss/SearchWorks/pull/1204","diff_url":"https://github.com/sul-dlss/SearchWorks/pull/1204.diff","patch_url":"https://github.com/sul-dlss/SearchWorks/pull/1204.patch","issue_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/1204","number":1204,"state":"open","locked":false,"title":"Migrate old serials parsing helpers to new MarcField parsed …","user":{"login":"jkeck","id":96776,"avatar_url":"https://avatars.githubusercontent.com/u/96776?v=3","gravatar_id":"","url":"https://api.github.com/users/jkeck","html_url":"https://github.com/jkeck","followers_url":"https://api.github.com/users/jkeck/followers","following_url":"https://api.github.com/users/jkeck/following{/other_user}","gists_url":"https://api.github.com/users/jkeck/gists{/gist_id}","starred_url":"https://api.github.com/users/jkeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkeck/subscriptions","organizations_url":"https://api.github.com/users/jkeck/orgs","repos_url":"https://api.github.com/users/jkeck/repos","events_url":"https://api.github.com/users/jkeck/events{/privacy}","received_events_url":"https://api.github.com/users/jkeck/received_events","type":"User","site_admin":false},"body":"…LinkedSerials class.\r\n\r\nCloses #1121 \r\n\r\n## 10750756 (before)\r\n<img width=\"585\" alt=\"10750756-before\" src=\"https://cloud.githubusercontent.com/assets/96776/13023971/6f8ef2c6-d1a3-11e5-9bf9-2ce60c5fe562.png\">\r\n\r\n## 10750756 (after)\r\n<img width=\"579\" alt=\"10750756-after\" src=\"https://cloud.githubusercontent.com/assets/96776/13023970/6f7bd79a-d1a3-11e5-88ee-5318381179ec.png\">\r\n\r\n## 358080 (before)\r\n<img width=\"557\" alt=\"358080-before\" src=\"https://cloud.githubusercontent.com/assets/96776/13023973/6f9ae70c-d1a3-11e5-889f-9d263c1898be.png\">\r\n\r\n## 358080 (after)\r\n<img width=\"504\" alt=\"358080-after\" src=\"https://cloud.githubusercontent.com/assets/96776/13023975/6f980dc0-d1a3-11e5-81bb-4887311c020e.png\">\r\n\r\n## 10781763 (before)\r\n<img width=\"368\" alt=\"10781763-before\" src=\"https://cloud.githubusercontent.com/assets/96776/13023974/6f9b30f4-d1a3-11e5-9c9a-2627809590be.png\">\r\n\r\n## 10781763 (after)\r\n<img width=\"383\" alt=\"10781763-after\" src=\"https://cloud.githubusercontent.com/assets/96776/13023972/6f9a542c-d1a3-11e5-9295-774acbad2ec0.png\">\r\n","created_at":"2016-02-13T00:13:59Z","updated_at":"2016-02-14T19:00:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9415e627972591d480b6eba6a6e42b2d611a3b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204/commits","review_comments_url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204/comments","review_comment_url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/1204/comments","statuses_url":"https://api.github.com/repos/sul-dlss/SearchWorks/statuses/722990bcdc89886d73e3826e1e5274e2dad00f3f","head":{"label":"sul-dlss:1121-linking-serials","ref":"1121-linking-serials","sha":"722990bcdc89886d73e3826e1e5274e2dad00f3f","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":19380542,"name":"SearchWorks","full_name":"sul-dlss/SearchWorks","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/SearchWorks","description":"SearchWorks (Stanford University Libraries)","fork":false,"url":"https://api.github.com/repos/sul-dlss/SearchWorks","forks_url":"https://api.github.com/repos/sul-dlss/SearchWorks/forks","keys_url":"https://api.github.com/repos/sul-dlss/SearchWorks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/SearchWorks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/SearchWorks/teams","hooks_url":"https://api.github.com/repos/sul-dlss/SearchWorks/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/SearchWorks/events","assignees_url":"https://api.github.com/repos/sul-dlss/SearchWorks/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/SearchWorks/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/SearchWorks/tags","blobs_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/SearchWorks/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/SearchWorks/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/SearchWorks/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/SearchWorks/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/SearchWorks/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/SearchWorks/subscription","commits_url":"https://api.github.com/repos/sul-dlss/SearchWorks/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/SearchWorks/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/SearchWorks/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/SearchWorks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/SearchWorks/merges","archive_url":"https://api.github.com/repos/sul-dlss/SearchWorks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/SearchWorks/downloads","issues_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/SearchWorks/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/SearchWorks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/SearchWorks/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/SearchWorks/releases{/id}","deployments_url":"https://api.github.com/repos/sul-dlss/SearchWorks/deployments","created_at":"2014-05-02T16:08:20Z","updated_at":"2016-01-16T03:08:50Z","pushed_at":"2016-02-13T07:58:28Z","git_url":"git://github.com/sul-dlss/SearchWorks.git","ssh_url":"git@github.com:sul-dlss/SearchWorks.git","clone_url":"https://github.com/sul-dlss/SearchWorks.git","svn_url":"https://github.com/sul-dlss/SearchWorks","homepage":"http://searchworks.stanford.edu","size":3757,"stargazers_count":9,"watchers_count":9,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":102,"forks":3,"open_issues":102,"watchers":9,"default_branch":"master"}},"base":{"label":"sul-dlss:master","ref":"master","sha":"6d21e7cbb96e290eae50dd0ee19bf70d8da2ad59","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":19380542,"name":"SearchWorks","full_name":"sul-dlss/SearchWorks","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/SearchWorks","description":"SearchWorks (Stanford University Libraries)","fork":false,"url":"https://api.github.com/repos/sul-dlss/SearchWorks","forks_url":"https://api.github.com/repos/sul-dlss/SearchWorks/forks","keys_url":"https://api.github.com/repos/sul-dlss/SearchWorks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/SearchWorks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/SearchWorks/teams","hooks_url":"https://api.github.com/repos/sul-dlss/SearchWorks/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/SearchWorks/events","assignees_url":"https://api.github.com/repos/sul-dlss/SearchWorks/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/SearchWorks/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/SearchWorks/tags","blobs_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/SearchWorks/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/SearchWorks/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/SearchWorks/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/SearchWorks/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/SearchWorks/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/SearchWorks/subscription","commits_url":"https://api.github.com/repos/sul-dlss/SearchWorks/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/SearchWorks/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/SearchWorks/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/SearchWorks/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/SearchWorks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/SearchWorks/merges","archive_url":"https://api.github.com/repos/sul-dlss/SearchWorks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/SearchWorks/downloads","issues_url":"https://api.github.com/repos/sul-dlss/SearchWorks/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/SearchWorks/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/SearchWorks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/SearchWorks/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/SearchWorks/releases{/id}","deployments_url":"https://api.github.com/repos/sul-dlss/SearchWorks/deployments","created_at":"2014-05-02T16:08:20Z","updated_at":"2016-01-16T03:08:50Z","pushed_at":"2016-02-13T07:58:28Z","git_url":"git://github.com/sul-dlss/SearchWorks.git","ssh_url":"git@github.com:sul-dlss/SearchWorks.git","clone_url":"https://github.com/sul-dlss/SearchWorks.git","svn_url":"https://github.com/sul-dlss/SearchWorks","homepage":"http://searchworks.stanford.edu","size":3757,"stargazers_count":9,"watchers_count":9,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":102,"forks":3,"open_issues":102,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204"},"html":{"href":"https://github.com/sul-dlss/SearchWorks/pull/1204"},"issue":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/1204"},"comments":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/issues/1204/comments"},"review_comments":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204/comments"},"review_comment":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/pulls/1204/commits"},"statuses":{"href":"https://api.github.com/repos/sul-dlss/SearchWorks/statuses/722990bcdc89886d73e3826e1e5274e2dad00f3f"}}}}