Skip to content

Commit

Permalink
Merge pull request #160 from MITLibraries/gdt-271-publishers-in-more-…
Browse files Browse the repository at this point in the history
…info

Add publishers to geospatial full records
  • Loading branch information
jazairi authored Apr 5, 2024
2 parents 9cb4da5 + a10100a commit c2e2923
Show file tree
Hide file tree
Showing 14 changed files with 196 additions and 102 deletions.
2 changes: 1 addition & 1 deletion app/helpers/record_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def access_type(metadata)
# Note: the publishers field is not yet available in TIMDEX API, but it should be added here once it is.
def more_info_geo?(metadata)
relevant_fields = %w[alternate_titles contributors dates format identifiers languages locations
links notes provider rights]
links notes provider publishers rights]
metadata.keys.any? { |key| relevant_fields.include? key }
end

Expand Down
6 changes: 5 additions & 1 deletion app/models/timdex_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class TimdexRecord < TimdexBase
physicalDescription
provider
publicationFrequency
publicationInformation
publishers {
date
location
name
}
relatedItems {
description
itemType
Expand Down
10 changes: 10 additions & 0 deletions app/views/record/_more_info_geo.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,14 @@
</ul>
</li>
<% end %>

<% if metadata['publishers'].present? %>
<li><strong>Publishers</strong>
<ul>
<% parse_nested_field(metadata['publishers']).each do |subfield| %>
<li><%= render_subfield(subfield) %></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
81 changes: 79 additions & 2 deletions config/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,61 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Publishers",
"description": null,
"fields": [
{
"name": "date",
"description": "The date of the publication",
"args": [

],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "location",
"description": "Where the publisher is located",
"args": [

],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "The name of the publisher",
"args": [

],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [

],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Query",
Expand Down Expand Up @@ -1943,7 +1998,7 @@
}
},
"isDeprecated": true,
"deprecationReason": "Use `publicationInformation`"
"deprecationReason": "Use `publishers`"
},
{
"name": "inBibliography",
Expand Down Expand Up @@ -2243,7 +2298,7 @@
},
{
"name": "publicationInformation",
"description": "Imprint information for item",
"description": null,
"args": [

],
Expand All @@ -2260,6 +2315,28 @@
}
}
},
"isDeprecated": true,
"deprecationReason": "Use `publishers`"
},
{
"name": "publishers",
"description": "Publishers that are associated with the item",
"args": [

],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Publishers",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
Expand Down
4 changes: 4 additions & 0 deletions test/helpers/record_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ class RecordHelperTest < ActionView::TestCase

provider_record = { 'provider' => 'MIT' }
assert more_info_geo?(provider_record)

publishers_record = { 'publishers' => [{ 'name' => 'Jagjaguwar', 'location' => 'Bloomington, IN',
'date' => '2011' }] }
assert more_info_geo?(provider_record)
end

test 'more_info_geo? false if no more info available' do
Expand Down
22 changes: 11 additions & 11 deletions test/vcr_cassettes/alma_record_with_no_publication_date.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2e2923

Please sign in to comment.