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

pulibrary / bibdata / 2b274cd3-5d04-438b-ba47-a8d5eeac0c16

11 Aug 2025 04:31PM UTC coverage: 87.857% (-4.3%) from 92.158%
2b274cd3-5d04-438b-ba47-a8d5eeac0c16

Pull #2830

circleci

sandbergja
[#2746] Begin indexing access restriction notes

Advances #2746
Pull Request #2830: [#2746] Begin indexing access restriction notes

3350 of 3813 relevant lines covered (87.86%)

668.76 hits per line

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

70.59
/marc_to_solr/lib/embargo_date_extractor.rb
1
class EmbargoDateExtractor
1✔
2
  def initialize(record)
1✔
3
    @record = record
78✔
4
  end
5

6
  def dates
1✔
7
    @dates ||= extract_dates
78✔
8
  end
9

10
  private
1✔
11

12
    def extract_dates
1✔
13
      restriction_notes = @record.select do |field|
78✔
14
        field.tag == '506' &&
320✔
15
          field.any? { |subfield| subfield.code == '5' && subfield.value == 'NjP' } &&
6✔
16
          field.any? { |subfield| subfield.code == 'g' }
×
17
      end
18
      restriction_notes.map { |field| parse_date(field['g']) }.compact
78✔
19
    end
20

21
    def parse_date(string)
1✔
22
      year = string[0..3].to_i
×
23
      month = string[4..5].to_i
×
24
      day = string[6..7].to_i
×
25
      Date.new(year, month, day) if Date.valid_date?(year, month, day)
×
26
    end
27
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