• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / bibdata / fa8448dd-0600-47e7-8889-1dfa562d11f0

05 Sep 2023 08:01PM UTC coverage: 86.172% (-4.9%) from 91.048%
fa8448dd-0600-47e7-8889-1dfa562d11f0

push

circleci

sandbergja
i2239: Use SRU instead of Alma API for bib record retrieval

8 of 8 new or added lines in 2 files covered. (100.0%)

3309 of 3840 relevant lines covered (86.17%)

326.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/adapters/alma_adapter/recap_alma_holding.rb
1
class AlmaAdapter
×
2
  # Handle the differences in holding enrichments done for ReCAP only.
3
  class RecapAlmaHolding < AlmaHolding
×
4
    # ReCAP can't handle a call number with both an 'h' and an 'i' subfield, so
5
    # combine them both into 'h'
6
    def enriched_852
×
7
      super.map do |original_field|
×
8
        original_field.tap do |field|
×
9
          call_no = callno_from_852(field)
×
10
          field.subfields.delete_if { |s| ['h', 'i'].include? s.code }
×
11
          field.append(MARC::Subfield.new('h', call_no))
×
12
          combine_location(field)
×
13
        end
×
14
      end
×
15
    end
×
16

17
    private
×
18

19
      # We need to combine 852 b/c for recap.
20
      def combine_location(field)
×
21
        return if field["b"].to_s.include?("$")
×
22
        b_code = "#{field['b']}$#{field['c']}"
×
23
        field.subfields.delete_if { |s| s.code == 'b' }
×
24
        field.append(MARC::Subfield.new('b', b_code))
×
25
      end
×
26

27
      # Copied from VoyagerHelpers. Combines h and i into one callnumber.
28
      def callno_from_852(field)
×
29
        call_no = field['h']
×
30
        return call_no if call_no.nil?
×
31
        call_no << ' ' + field['i'] if field['i']
×
32
        call_no.gsub!(/^[[:blank:]]+(.*)$/, '\1')
×
33
        call_no
×
34
      end
×
35
  end
×
36
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc