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

pulibrary / tigerdata-app / 2e85105d-f9c8-41e9-8b05-fe438b698516

26 Nov 2025 12:16PM UTC coverage: 71.597% (-8.0%) from 79.623%
2e85105d-f9c8-41e9-8b05-fe438b698516

push

circleci

web-flow
Display the data sponsor and data manager in the dashboard listing (#2247)

Closes #2236 

<img width="1036" height="675" alt="Screenshot 2025-11-25 at 3 07 41 PM"
src="https://github.com/user-attachments/assets/3b6a2189-7f71-4b17-97e5-e66c8fed3cb3"
/>

1 of 3 new or added lines in 1 file covered. (33.33%)

346 existing lines in 26 files now uncovered.

2367 of 3306 relevant lines covered (71.6%)

147.24 hits per line

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

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

8
    private
1✔
9

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

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

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

35

36
    def convert_results(result_ids)
1✔
37
      projects_not_found = []
3✔
38
      projects = []
3✔
39
      result_ids.map do |mediaflux_id|
3✔
40
        project = Project.find_by(mediaflux_id: )
25✔
41
        if project.blank?
25✔
42
          projects_not_found << mediaflux_id
19✔
43
        else
44
          projects << project
6✔
45
        end
46
      end
47
      if projects_not_found.count > 0
3✔
48
        Rails.logger.error("The following Mediaflux Projects were not found in the Rails database: #{projects_not_found.join(', ')}")
1✔
49
        Honeybadger.notify("The following Mediaflux Projects were not found in the Rails database: #{projects_not_found.join(', ')}")
1✔
50
      end
51
      Success(projects)
3✔
52
    end
53
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