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

pulibrary / tigerdata-app / e7a92392-be4c-4214-89f9-e70084a3165f

03 Nov 2025 06:52PM UTC coverage: 46.881% (-44.5%) from 91.394%
e7a92392-be4c-4214-89f9-e70084a3165f

Pull #2128

circleci

hectorcorrea
Rubocop
Pull Request #2128: Project Show page now displays metadata straight from Mediaflux

35 of 61 new or added lines in 6 files covered. (57.38%)

764 existing lines in 37 files now uncovered.

1646 of 3511 relevant lines covered (46.88%)

69.44 hits per line

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

0.0
/app/operations/project_search.rb
UNCOV
1
class ProjectSearch < Dry::Operation
×
UNCOV
2
    def call(search_string:, requestor:, field_name: "Title")
×
UNCOV
3
        verified_search_string = step verify_search_string(search_string)
×
UNCOV
4
        result_ids = step query_mediaflux(search_string: verified_search_string, requestor:, field_name:)
×
UNCOV
5
        step convert_results(result_ids)
×
UNCOV
6
    end
×
7

UNCOV
8
    private
×
9

UNCOV
10
    def verify_search_string(search_string)
×
11
        # An empty search does not make sense
UNCOV
12
        if search_string.blank?
×
13
            Failure("Search String cannot be empty")
×
14
        # Assuming there may be more verifications in the future
UNCOV
15
        else
×
UNCOV
16
            Success(search_string)
×
UNCOV
17
        end
×
UNCOV
18
    end
×
19

UNCOV
20
    def query_mediaflux(search_string:, requestor:, field_name:)
×
UNCOV
21
      query = mediaflux_query(search_string:, requestor:, field_name:)
×
UNCOV
22
      if query.error?
×
23
        Failure("Error querying mediaflux: #{query.response_error[:message]}")
×
UNCOV
24
      else
×
UNCOV
25
        result_ids = query.result_items.map{|result| result[:id]}
×
UNCOV
26
        Success(result_ids)
×
UNCOV
27
      end
×
UNCOV
28
    end
×
29

UNCOV
30
    def mediaflux_query(search_string:, requestor:, field_name:)
×
UNCOV
31
      aql_query = "xpath(tigerdata:project/#{field_name}) matches ignore-case '#{search_string}'"
×
UNCOV
32
      Mediaflux::QueryRequest.new(session_token: requestor.mediaflux_session, aql_query: , iterator: false )
×
UNCOV
33
    end
×
34

35

UNCOV
36
    def convert_results(result_ids)
×
UNCOV
37
        errors = []
×
UNCOV
38
        projects = result_ids.map do |mediaflux_id|
×
UNCOV
39
          project = Project.find_by(mediaflux_id: )
×
UNCOV
40
          if project.blank?
×
41
            errors << mediaflux_id
×
UNCOV
42
          end
×
UNCOV
43
          project
×
UNCOV
44
        end
×
UNCOV
45
        if errors.count > 0
×
46
          Failure("The following Mediaflux Projects were not found in the Rails database: #{errors.join(', ')}")
×
UNCOV
47
        else
×
UNCOV
48
          Success(projects)
×
UNCOV
49
        end
×
UNCOV
50
    end
×
UNCOV
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