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

pulibrary / allsearch_api / 3af098b5-d5f1-4d1b-9991-db42b4cf0d4e

01 Dec 2025 09:20PM UTC coverage: 99.903%. Remained the same
3af098b5-d5f1-4d1b-9991-db42b4cf0d4e

Pull #411

circleci

sandbergja
Start using ROM-rb for loading Library Database records from CSV

Helps with #402
Pull Request #411: Start using ROM-rb for loading Library Database records from CSV

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

9 existing lines in 2 files now uncovered.

1035 of 1036 relevant lines covered (99.9%)

108.64 hits per line

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

100.0
/app/repositories/banner_repository.rb
1
# frozen_string_literal: true
2

3
require 'rom-repository'
3✔
4

5
# This repository translates between the objects and methods in our repository and the data and queries in our database
6
# To instantiate:
7
# br = BannerRepository.new env['rom']
8
# br.banners.first
9
class BannerRepository < ROM::Repository[:banners]
3✔
10
  def modify(new_values)
3✔
UNCOV
11
    existing_banner = banners.first
5✔
UNCOV
12
    if existing_banner
5✔
UNCOV
13
      update existing_banner.id, new_values
3✔
14
    else
UNCOV
15
      create new_values
2✔
16
    end
17
  end
18

19
  def delete
3✔
20
    # There should only ever be one, banner, so it is safe to delete them all
UNCOV
21
    banners.changeset(:delete).commit
2✔
22
  end
23

24
  commands :create,
3✔
25
           use: :timestamps,
26
           plugins_options: { timestamps: { timestamps: [:created_at, :updated_at] } }
27

28
  commands update: :by_pk,
3✔
29
           use: :timestamps,
30
           plugins_options: { timestamps: { timestamps: [:updated_at] } }
31

32
  module Structs
3✔
33
    # This struct represents a row from the banners database table
34
    class Banner < ROM::Struct
3✔
35
      # :reek:UtilityFunction
36
      def display?
3✔
37
        Flipper.enabled?(:banner)
7✔
38
      end
39

40
      def status_code
3✔
41
        ALERT_STATUS_CODES[alert_status]
7✔
42
      end
43

44
      def as_json
3✔
45
        {
46
          text:,
7✔
47
          display_banner: display?,
48
          alert_status: status_code,
49
          dismissible:,
50
          autoclear:
51
        }.to_json
52
      end
53
    end
54
  end
55
  auto_struct true
3✔
56
  struct_namespace Structs
3✔
57
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