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

pulibrary / pdc_discovery / 3d2f72c5-75d9-474f-b4d1-6f0ef5804913

pending completion
3d2f72c5-75d9-474f-b4d1-6f0ef5804913

Pull #447

circleci

hectorcorrea
Update fixture to reflect mult-value domain field
Pull Request #447: Indexing community, subcommunity, and domain from PDC Describe

7 of 7 new or added lines in 4 files covered. (100.0%)

2082 of 2238 relevant lines covered (93.03%)

144.26 hits per line

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

78.95
/lib/traject/import_helper.rb
1
# frozen_string_literal: true
2

3
class ImportHelper
1✔
4
  def self.uri_with_prefix(prefix, value)
1✔
5
    return nil if value.blank?
×
6
    "#{prefix}/#{value}"
×
7
  end
8

9
  def self.doi_uri(value)
1✔
10
    uri_with_prefix("https://doi.org", value)
×
11
  end
12

13
  def self.ark_uri(value)
1✔
14
    uri_with_prefix("http://arks.princeton.edu", value)
×
15
  end
16

17
  # Returns true if a record already exists in Solr for the given URIs
18
  # and that record was imported from PDC Describe.
19
  def self.pdc_describe_match?(solr_url, uris)
1✔
20
    ark_uri = uris.find { |uri| uri.text.start_with?("http://arks.princeton.edu/ark:/") }&.text
888✔
21
    return true if pdc_describe_match_by_uri?(solr_url, ark_uri)
472✔
22

23
    doi_uri = uris.find { |uri| uri.text.start_with?("https://doi.org/10.34770/") }&.text
910✔
24
    return true if pdc_describe_match_by_uri?(solr_url, doi_uri)
471✔
25

26
    false
471✔
27
  end
28

29
  # Returns true if a record already exists in Solr for the given URI
30
  # and that record was imported from PDC Describe.
31
  def self.pdc_describe_match_by_uri?(solr_url, uri)
1✔
32
    return false if uri.nil?
943✔
33
    solr_query = File.join(solr_url, "select?q=data_source_ssi:pdc_describe+AND+uri_ssim:\"#{uri}\"")
426✔
34
    response = HTTParty.get(solr_query)
426✔
35
    response.parsed_response["response"]["numFound"] != 0
426✔
36
  end
37
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