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

pulibrary / pdc_describe / 4e4e59fc-9df4-4838-9fd4-6c7ea33cdb7c

07 Apr 2025 06:36PM UTC coverage: 1.283% (-94.6%) from 95.862%
4e4e59fc-9df4-4838-9fd4-6c7ea33cdb7c

Pull #1994

circleci

hectorcorrea
Switched to use the autocomplete that we aleady use for ROR. Integrated it with the existing logic for creators
Pull Request #1994: Started adding auto complete to contributors

0 of 46 new or added lines in 2 files covered. (0.0%)

4806 existing lines in 74 files now uncovered.

65 of 5065 relevant lines covered (1.28%)

0.01 hits per line

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

0.0
/app/decorators/form_resource_decorator.rb
1
# frozen_string_literal: true
UNCOV
2
class FormResourceDecorator
×
UNCOV
3
  attr_reader :resource, :current_user, :work
×
4

UNCOV
5
  SKIPPED_ROLES = ["DISTRIBUTOR", "FUNDER", "HOSTING_INSTITUTION", "REGISTRATION_AGENCY", "REGISTRATION_AUTHORITY", "RESEARCH GROUP"].freeze
×
UNCOV
6
  PPPL_FUNDER_NAME = "United States Department of Energy"
×
UNCOV
7
  PPPL_FUNDER_ROR = "https://ror.org/01bj3aw27"
×
UNCOV
8
  PPPL_FUNDER_AWARD_NUMBER = "DE-AC02-09CH11466"
×
9

UNCOV
10
  def initialize(work, current_user)
×
UNCOV
11
    @resource = work.resource
×
UNCOV
12
    @work = work
×
UNCOV
13
    @current_user = current_user
×
UNCOV
14
  end
×
15

UNCOV
16
  def funders # @funders probably null for some reason
×
UNCOV
17
    @funders ||= begin
×
UNCOV
18
                   empty_row = if pppl? && resource.funders.empty?
×
UNCOV
19
                                 PDCMetadata::Funder.new(PPPL_FUNDER_ROR, PPPL_FUNDER_NAME, PPPL_FUNDER_AWARD_NUMBER, nil)
×
UNCOV
20
                               end
×
UNCOV
21
                   resource.funders + [empty_row]
×
UNCOV
22
                 end
×
UNCOV
23
  end
×
24

UNCOV
25
  def individual_contributors
×
UNCOV
26
    item_or_nil_array(resource.individual_contributors)
×
UNCOV
27
  end
×
28

UNCOV
29
  def contributor_types
×
UNCOV
30
    @contributor_types ||= Datacite::Mapping::ContributorType.to_a.reject { |role| SKIPPED_ROLES.include? role.key.to_s }
×
UNCOV
31
    @contributor_types
×
UNCOV
32
  end
×
33

UNCOV
34
  def related_objects
×
UNCOV
35
    item_or_nil_array(resource.related_objects)
×
UNCOV
36
  end
×
37

UNCOV
38
  def creators
×
UNCOV
39
    item_or_nil_array(resource.creators)
×
UNCOV
40
  end
×
41

UNCOV
42
  def organizational_contributors
×
UNCOV
43
    resource.organizational_contributors + [nil]
×
UNCOV
44
  end
×
45

UNCOV
46
  def doi_mutable?
×
UNCOV
47
    return true unless !@work.nil? && @work.persisted?
×
48

UNCOV
49
    !@work.approved?
×
UNCOV
50
  end
×
51

UNCOV
52
  private
×
53

UNCOV
54
    def item_or_nil_array(item)
×
UNCOV
55
      if item.empty?
×
UNCOV
56
        [nil]
×
UNCOV
57
      else
×
UNCOV
58
        item
×
UNCOV
59
      end
×
UNCOV
60
    end
×
61

UNCOV
62
    def pppl?
×
UNCOV
63
      work.group == Group.plasma_laboratory
×
UNCOV
64
    end
×
UNCOV
65
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