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

pulibrary / allsearch_api / 8cca27ea-0ec0-4546-b1e5-0dc9f1ef05a3

31 Oct 2025 06:27PM UTC coverage: 99.903% (+0.003%) from 99.9%
8cca27ea-0ec0-4546-b1e5-0dc9f1ef05a3

Pull #389

circleci

sandbergja
Replace uses of the Banner ActiveRecord model with Rom-RB

The ActiveRecord model is still used in tests and a database migration,
maybe those could be migrated to Rom-RB in a separate PR?

A Rom Container is created that uses the same database connections as
ActiveRecord.  This allows rom to use the same database transactions
as activerecord, allowing tests (which use db transactions to stay
isolated from one another) to still pass.
Pull Request #389: Replace uses of the Banner ActiveRecord model with Rom-RB

34 of 39 new or added lines in 4 files covered. (87.18%)

57 existing lines in 13 files now uncovered.

1031 of 1032 relevant lines covered (99.9%)

112.35 hits per line

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

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

3
# This class is responsible for getting relevant
4
# metadata from the Catalog's JSON
5
# The document is a Hash
6
class CatalogDocument < Document
3✔
7
  include SolrDocument
3✔
8

9
  private
3✔
10

11
  include Holdings
3✔
12

13
  def service
3✔
14
    'catalog'
115✔
15
  end
16

17
  def title
3✔
18
    document[:title_display]
114✔
19
  end
20

21
  def creator
3✔
22
    document[:author_display]&.first
113✔
23
  end
24

25
  def publisher
3✔
26
    document[:pub_created_display]&.first
113✔
27
  end
28

29
  def type
3✔
30
    document[:format]&.first
113✔
31
  end
32

33
  def description
3✔
34
    # tbd - nothing in the current json that seems relevant
35
  end
36

37
  def doc_keys
3✔
38
    [:first_barcode, :second_barcode, :first_call_number, :second_call_number, :first_library, :second_library,
114✔
39
     :first_status, :second_status, :online_access_count, :resource_url, :resource_url_label]
40
  end
41

42
  def online_access_count
3✔
43
    ea_count = electronic_access&.count || 0
114✔
44
    portfolio_count = document[:electronic_portfolio_s]&.count || 0
114✔
45
    ea_count + portfolio_count
114✔
46
  end
47

48
  def resource_url
3✔
49
    portfolio['url'] || electronic_access&.keys&.first
116✔
50
  end
51

52
  def resource_url_label
3✔
53
    return unless should_display_resource_url_label?
118✔
54

UNCOV
55
    portfolio['title'] || electronic_access&.values&.first&.first || 'Online content'
14✔
56
  end
57

58
  def should_display_resource_url_label?
3✔
59
    portfolio.present? || electronic_access.present?
118✔
60
  end
61

62
  def portfolio
3✔
63
    @portfolio ||= begin
248✔
64
      portfolio_string = document[:electronic_portfolio_s]&.first
120✔
65
      portfolio_string.present? ? JSON.parse(portfolio_string) : {}
120✔
66
    end
67
  end
68

69
  def electronic_access
3✔
70
    @electronic_access ||= begin
325✔
71
      electronic_access_string = document[:electronic_access_1display]
118✔
72
      electronic_access_string.present? ? JSON.parse(electronic_access_string) : {}
118✔
73
    end
74
  end
75

76
  def do_not_sanitize_these_fields
3✔
77
    super + [:resource_url]
2,178✔
78
  end
79
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