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

pulibrary / allsearch_api / 9eae8e03-b4ba-4fef-a63b-d5780d976746

30 Jun 2025 12:00PM UTC coverage: 99.492% (+0.001%) from 99.491%
9eae8e03-b4ba-4fef-a63b-d5780d976746

Pull #379

circleci

maxkadel
Ensure we sort library staff correctly, and include bios in searchable field

Closes #371

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>
Co-authored-by: Kevin Reiss <kevinreiss@users.noreply.github.com>
Co-authored-by: Ryan Laddusaw <rladdusaw@users.noreply.github.com>
Pull Request #379: Ensure we sort library staff correctly, and include bios in searchabl…

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

95 existing lines in 17 files now uncovered.

979 of 984 relevant lines covered (99.49%)

101.71 hits per line

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

100.0
/app/models/library_database_record.rb
1
# frozen_string_literal: true
2

3
LIBRARY_DATABASE_CSV_FIELDS = [:libguides_id, :name, :description, :alt_names_concat, :url,
3✔
4
                               :friendly_url, :subjects_concat].freeze
5

6
class LibraryDatabaseRecord < ApplicationRecord
3✔
7
  scope :query, lambda { |search_term|
3✔
UNCOV
8
                  where(
46✔
9
                    Arel.sql("searchable @@ websearch_to_tsquery('unaccented_dict', unaccent(?))",
10
                             search_term)
11
                  ).order(
12
                    Arel.sql("ts_rank(searchable, websearch_to_tsquery('unaccented_dict', unaccent(?)))",
13
                             search_term).desc
14
                  )
15
                }
16

17
  # :reek:TooManyStatements
18
  def self.new_from_csv(row)
3✔
19
    record = LibraryDatabaseRecord.new
309✔
20
    LIBRARY_DATABASE_CSV_FIELDS.each_with_index { |field, index| record.method(:"#{field}=").call(row[index]) }
2,472✔
21
    record.alt_names = record.alt_names_concat&.split('; ')
309✔
22
    record.subjects = record.subjects_concat&.split(';')
309✔
23
    record.save
309✔
24
    record
309✔
25
  end
26
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