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

pulibrary / orangelight / df64ddc8-90c3-487d-9aa2-3b77b7bd21e5

14 Apr 2026 04:41PM UTC coverage: 0.454% (-95.0%) from 95.439%
df64ddc8-90c3-487d-9aa2-3b77b7bd21e5

push

circleci

web-flow
Remove Preservation Conservation work order type check (#5765)

Make sure description and enum is not an empty string

The specific issue appears for items in East Asian with bad data in Alma that fail the eligibility check for the Illiad service.
The problem was only revealed now after the changes in https://github.com/pulibrary/bibdata/pull/3178.

For the East Asian items the enum and description values are empty strings, so the specific  method returns that are present and not nil . The next Illiad eligibility check is the Preservation Conservation which does not exist anymore as a status label.
So the Illiad service eligibility check fails.

related to [#5755]

0 of 7 new or added lines in 4 files covered. (0.0%)

9770 existing lines in 228 files now uncovered.

46 of 10128 relevant lines covered (0.45%)

0.01 hits per line

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

0.0
/lib/orangelight/string_functions.rb
1
# frozen_string_literal: true
2

UNCOV
3
module StringFunctions
×
UNCOV
4
  class << self
×
UNCOV
5
    def cn_normalize(str)
×
UNCOV
6
      if /^[a-zA-Z]{2,3} \d+([qQ]?)$/.match? str # the normalizer thinks "CD 104" is valid LC
×
UNCOV
7
        accession_number(str)&.strip
×
UNCOV
8
      else
×
UNCOV
9
        Lcsort.normalize(str.gsub(/x([A-Z])/, '\1'))&.strip || accession_number(str)&.strip
×
UNCOV
10
      end
×
UNCOV
11
    end
×
12

UNCOV
13
    def oclc_normalize(oclc, _opts = { prefix: false })
×
UNCOV
14
      oclc.gsub(/\D/, '').to_i.to_s
×
UNCOV
15
    end
×
16

17
    # Needed for name-title browse
18
    # https://github.com/traject/traject/blob/v2.3.1/lib/traject/macros/marc21.rb#L227
UNCOV
19
    def trim_punctuation(str)
×
20
      # If something went wrong and we got a nil, just return it
UNCOV
21
      return str unless str
×
22

23
      # trailing: comma, slash, semicolon, colon (possibly preceded and followed by whitespace)
UNCOV
24
      str = str.sub(%r{ *[ ,/;:] *\Z}, '')
×
25

26
      # trailing period if it is preceded by at least three letters
27
      # (possibly preceded and followed by whitespace)
UNCOV
28
      str = str.sub(/( *\w\w\w)\. *\Z/, '\1')
×
29

30
      # single square bracket characters if they are the start and/or end
31
      #   chars and there are no internal square brackets.
UNCOV
32
      str = str.sub(/\A\[?([^\[\]]+)\]?\Z/, '\1')
×
33

34
      # trim any leading or trailing whitespace
UNCOV
35
      str.strip!
×
36

UNCOV
37
      str
×
UNCOV
38
    end
×
39

UNCOV
40
    private
×
41

UNCOV
42
      def accession_number(str)
×
UNCOV
43
        norm = str.upcase
×
UNCOV
44
        norm = norm.gsub(/(CD|DVD|LP|LS)-/, '\1') # should file together regardless of dash
×
45

46
        # normalize number to 7-digits, ignore oversize q
UNCOV
47
        norm.gsub(/(\d{1,7})(Q$|Q OVERSIZE$)?/) do
×
UNCOV
48
          format('%07d', Regexp.last_match[1].to_i)
×
UNCOV
49
        end
×
UNCOV
50
      end
×
UNCOV
51
  end
×
UNCOV
52
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

© 2026 Coveralls, Inc