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

pulibrary / allsearch_api / dc764cb3-fc9b-47a1-b010-56b68ecb28a7

01 Aug 2025 03:30PM UTC coverage: 99.514%. Remained the same
dc764cb3-fc9b-47a1-b010-56b68ecb28a7

push

circleci

web-flow
Merge pull request #384 from pulibrary/dependabot/bundler/nokogiri-1.18.9

Bump nokogiri from 1.18.8 to 1.18.9

1024 of 1029 relevant lines covered (99.51%)

92.23 hits per line

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

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

3
# This class is responsible for storing and retrieving relevant
4
# metadata from the best_bet_record table in the database
5
class BestBetRecord < ApplicationRecord
3✔
6
  validates :title, :url, :search_terms, presence: true
3✔
7
  scope :query, lambda { |search_term|
3✔
8
                  where('unaccent(?) ILIKE ANY(search_terms) OR unaccent(?) ILIKE title', search_term, search_term)
23✔
9
                }
10
  def self.new_from_csv(row)
3✔
11
    BestBetRecord.create!(
72✔
12
      title: row[0],
13
      description: row[1],
14
      url: row[2],
15
      search_terms: row[3]&.split(', ')&.map { |term| Normalizer.new(term).without_diacritics },
217✔
16
      last_update: last_update(row)
17
    )
18
  rescue ActiveRecord::RecordInvalid => error
19
    Rails.logger.error("Could not create new BestBet for row #{row}: #{error.message}")
4✔
20
  end
21

22
  def self.last_update(row)
3✔
23
    update = row[4]
72✔
24
    return nil if update.blank?
72✔
25

26
    Date.strptime(update, '%B %d, %Y')
70✔
27
  rescue Date::Error
28
    Rails.logger.info("Invalid date for BestBet row: #{row}")
1✔
29
  end
30
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