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

pulibrary / tigerdata-app / 863e578f-15a5-4c93-8357-08f855de0bbc

24 Nov 2025 02:23PM UTC coverage: 87.366% (-0.7%) from 88.064%
863e578f-15a5-4c93-8357-08f855de0bbc

Pull #2235

circleci

carolyncole
Do not redirect from home page when login is disabled
fixes #2188
Pull Request #2235: Do not redirect from home page when login is disabled

5 of 5 new or added lines in 2 files covered. (100.0%)

834 existing lines in 48 files now uncovered.

2773 of 3174 relevant lines covered (87.37%)

499.78 hits per line

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

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

8
    private
3✔
9

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

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

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

35

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