Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access facet uniq fix #217

Merged
merged 2 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/marc_access_facet_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def extract_access_data(record, context)
end

access << 'Online' if context.output_hash&.dig('ht_id_ssim')
access.compact.uniq
access.compact!
access.uniq!
access.delete 'On Order' if not_only_on_order? access
access
end
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/access_uniq.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
008986789 00097 0010005000009490127000059490127001329490225002599490225004849490091007091234 aElectronic resourcewASISc1i4059691-2001lONLINEmONLINErYsYtONLINEu10/19/2007o.STAFF. 20071003 EEBO#2 STC1-59dedup aElectronic resourcewASISc1i4059691-2001lONLINEmONLINErYsYtONLINEu10/19/2007o.STAFF. 20071003 EEBO#2 STC1-59dedup aMicrofilm D18 reel.907:1wASISc1i000079527897d10/2/2009e7/22/2009lCATO-2mUP-ANNEXn1q1rYsYtMICROFORMu10/19/2007z8043o.STAFF. Upon return, route to cataloging. 7/21/09 smo.STAFF. 20071003 EEBO#2 STC1-59dedup aMicrofilm D18 reel.907:1wASISc1i000079527897d10/2/2009e7/22/2009lCATO-2mUP-ANNEXn1q1rYsYtMICROFORMu10/19/2007z8043o.STAFF. Upon return, route to cataloging. 7/21/09 smo.STAFF. 20071003 EEBO#2 STC1-59dedup aAQ14656449wLCc1i000080938682lON-ORDERmUP-PATrYsYtBOOKu1/10/2019o.STAFF. GOBI
5 changes: 5 additions & 0 deletions spec/lib/traject/access_facet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
expect(result['access_facet']).to contain_exactly 'In the Library', 'Online'
end

it 'produces a uniq set of access facet values' do
result = @indexer.map_record(MARC::Reader.new(File.join(fixture_path, 'access_uniq.mrc')).to_a.first)
expect(result['access_facet']).to contain_exactly 'Online', 'In the Library'
end

it 'produces Other when a record has a 949m library code that is not listed' do
result = @indexer.map_record(MARC::Reader.new(File.join(fixture_path, 'access_other.mrc')).to_a.first)
expect(result['access_facet']).to contain_exactly 'Other'
Expand Down