Skip to content

Commit

Permalink
Access facet uniq fix (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
Banu Hapeloglu Kutlu authored Jun 17, 2020
1 parent a2a900b commit a5247f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
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

0 comments on commit a5247f5

Please sign in to comment.