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

pulibrary / pdc_describe / 2d96f6f4-15bf-41be-810d-7e75e8f56891

24 Feb 2025 10:17PM UTC coverage: 95.808% (-0.3%) from 96.121%
2d96f6f4-15bf-41be-810d-7e75e8f56891

Pull #1994

circleci

hectorcorrea
Made the controller and model respect the search parameters
Pull Request #1994: Started adding auto complete to contributors

15 of 27 new or added lines in 2 files covered. (55.56%)

3360 of 3507 relevant lines covered (95.81%)

400.66 hits per line

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

42.86
/app/models/researcher.rb
1
# frozen_string_literal: true
2
class Researcher < ApplicationRecord
2✔
3
  def self.new_researcher(first_name, last_name, orcid, netid)
2✔
NEW
4
    researcher = Researcher.where(netid: netid).first
×
NEW
5
    if researcher == nil
×
NEW
6
      researcher = Researcher.new
×
NEW
7
      researcher.netid = netid
×
8
    end
NEW
9
    researcher.first_name = first_name
×
NEW
10
    researcher.last_name = last_name
×
NEW
11
    researcher.orcid = orcid
×
NEW
12
    researcher.save!
×
NEW
13
    return researcher
×
14
  end
15

16
  def self.autocomplete_search(query)
2✔
17
    collection = if query.blank?
52✔
NEW
18
      Researcher.all
×
19
    else
20
      like_query = "%#{query.strip.downcase}%"
52✔
21
      Researcher.where('lower(first_name) like ?', like_query)
52✔
22
    end
23
    researchers = []
52✔
24
    collection.each do |researcher|
52✔
NEW
25
      display_value = "#{researcher.first_name} #{researcher.last_name} (#{researcher.netid})"
×
NEW
26
      researchers << {value: display_value, data: researcher.netid}
×
27
    end
28
    return researchers
52✔
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