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

pulibrary / bibdata / 1dcebae2-3318-4e77-bc53-82276e293354

02 May 2025 04:45PM UTC coverage: 28.256% (-63.9%) from 92.189%
1dcebae2-3318-4e77-bc53-82276e293354

push

circleci

sandbergja
Add basic infrastructure for compiling rust code

* Add a rake compile task to compile
* Run the rake task in CI
* Run the rake task before rspec tests with the rust tag, to provide quick feedback on rust changes in TDD cycles

2 of 7 new or added lines in 2 files covered. (28.57%)

2467 existing lines in 97 files now uncovered.

1089 of 3854 relevant lines covered (28.26%)

0.29 hits per line

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

45.45
/app/adapters/alma_adapter/bib_item_set.rb
1
class AlmaAdapter
1✔
2
  # Composite object for a set of items. Wraps up functionality for summarizing
3
  # all the items of a specific bib.
4
  class BibItemSet
1✔
5
    include Enumerable
1✔
6

7
    attr_reader :items, :adapter
1✔
8

9
    delegate :get_bib_record, to: :adapter
1✔
10
    # @param [Array<AlmaAdapter::AlmaItem>] items Array of items to wrap up.
11
    # @param [AlmaAdapter] adapter
12
    def initialize(items:, adapter:)
1✔
UNCOV
13
      @items = items
×
UNCOV
14
      @adapter = adapter
×
15
    end
16

17
    def each(&)
1✔
UNCOV
18
      items.each(&)
×
19
    end
20

21
    # minimal summary of locations / holdings / items data used for bib_items
22
    # response
23
    # @param item_key_filter [String] keys to include in the items hash
24
    # @return [Hash] of locations/ holdings/ items data
25
    def holding_summary(item_key_filter: nil)
1✔
UNCOV
26
      location_grouped = items.group_by(&:composite_location)
×
UNCOV
27
      location_grouped.map do |location_code, location_items|
×
UNCOV
28
        holdings = location_items.group_by(&:holding_id).map do |holding_id, holding_items|
×
29
          {
UNCOV
30
            'holding_id' => holding_id,
×
31
            'call_number' => holding_items.first.call_number,
32
            'items' => holding_items_filter(holding_items.map(&:as_json), item_key_filter)
33
          }.compact
34
        end
UNCOV
35
        [location_code, holdings]
×
36
      end.to_h
37
    end
38

39
    private
1✔
40

41
      def holding_items_filter(items, filter)
1✔
UNCOV
42
        return items unless filter
×
43

UNCOV
44
        items.map do |h|
×
UNCOV
45
          h.keep_if do |k, _v|
×
UNCOV
46
            filter.include? k
×
47
          end
48
        end
49
      end
50
  end
51
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