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

pulibrary / pdc_discovery / a127fe22-c660-46bf-898d-03a7863fa8fb

pending completion
a127fe22-c660-46bf-898d-03a7863fa8fb

Pull #466

circleci

hectorcorrea
Adjust the test to account for the new author formatting
Pull Request #466: Display author affiliation (for PDC Describe records)

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

2265 of 2353 relevant lines covered (96.26%)

187.04 hits per line

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

81.25
/app/models/authors_citation.rb
1
# frozen_string_literal: true
2

3
class AuthorsCitation
1✔
4
  attr_reader :authors
1✔
5

6
  def initialize(authors)
1✔
7
    @authors = authors
15✔
8
    set_affiliation_index
15✔
9
  end
10

11
  # Set the index affiliation for the set of authors
12
  def set_affiliation_index
1✔
13
    orgs = @authors.map(&:affiliation_name).compact.uniq
15✔
14
    indexed_orgs = []
15✔
15
    orgs.each_with_index do |name, index|
15✔
16
      indexed_orgs << { name: name, index: index + 1 }
×
17
    end
18

19
    @authors.each do |author|
15✔
20
      author_org = author.affiliation_name
83✔
21
      if author_org
83✔
22
        indexed_org = indexed_orgs.find { |org| org[:name] == author_org }
×
23
        author.affiliation_index = indexed_org[:index]
×
24
      else
25
        author.affiliation_index = 0
83✔
26
      end
27
    end
28
  end
29
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