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

pulibrary / allsearch_api / a8d8fc0f-d218-4ff0-8a65-91e6d0e0bf83

02 Dec 2025 04:00PM UTC coverage: 99.903%. Remained the same
a8d8fc0f-d218-4ff0-8a65-91e6d0e0bf83

push

circleci

web-flow
Merge pull request #414 from pulibrary/query-in-rom

Re-implement library database full text search in ROM-rb

29 of 29 new or added lines in 3 files covered. (100.0%)

68 existing lines in 12 files now uncovered.

1035 of 1036 relevant lines covered (99.9%)

105.75 hits per line

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

100.0
/app/models/physical_holding.rb
1
# frozen_string_literal: true
2

3
# This class is responsible for determining
4
# the status of a physical holding in the ILS
5
class PhysicalHolding
3✔
6
  def initialize(holding_id:, holding_data:, document_id:)
3✔
7
    @holding_id = holding_id
60✔
8
    @holding_data = holding_data
60✔
9
    @document_id = document_id
60✔
10
  end
11

12
  def barcode
3✔
13
    items&.first&.barcode
49✔
14
  end
15

16
  def call_number
3✔
17
    @holding_data['call_number']
49✔
18
  end
19

20
  def library
3✔
21
    @library ||= @holding_data['library']
103✔
22
  end
23

24
  def status
3✔
25
    return unless library
55✔
26

27
    if coin? || senior_thesis?
55✔
UNCOV
28
      'On-site access'
4✔
29
    elsif alma_temporary_location_status
51✔
UNCOV
30
      alma_temporary_location_status
2✔
31
    elsif alma_location_status
49✔
32
      alma_location_status
30✔
33
    end
34
  end
35

36
  private
3✔
37

38
  attr_accessor :document_id
3✔
39

40
  def alma?
3✔
41
    document_id.start_with?('99') && document_id.end_with?('6421')
132✔
42
  end
43

44
  def coin?
3✔
45
    document_id.start_with? 'coin-'
55✔
46
  end
47

48
  def senior_thesis?
3✔
49
    document_id.start_with? 'dsp'
52✔
50
  end
51

52
  def alma_temporary_location_status
3✔
53
    # temporary location holdings have an alphabetical holding id
54
    return unless alma? && @holding_id.match(/[a-zA-Z]\$[a-zA-Z]/)
53✔
55

UNCOV
56
    @holding_id == 'RES_SHARE$IN_RS_REQ' ? 'Unavailable' : 'View record for Full Availability'
4✔
57
  end
58

59
  def alma_location_status
3✔
60
    return unless alma?
79✔
61

62
    if items_in_place_count == items&.count
60✔
63
      'Available'
54✔
UNCOV
64
    elsif items_in_place_count.zero?
6✔
UNCOV
65
      'Unavailable'
4✔
UNCOV
66
    elsif items_in_place_count < items&.count
2✔
UNCOV
67
      'Some items not available'
2✔
68
    end
69
  end
70

71
  def items
3✔
72
    @items ||= @holding_data['items']&.map { |item| PhysicalItem.new item: } || []
238✔
73
  end
74

75
  def items_in_place_count
3✔
76
    items&.count(&:in_place?)
68✔
77
  end
78
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