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

pulibrary / pdc_describe / 9091a1ae-29be-458c-984a-339d213919c4

12 Dec 2024 07:41PM UTC coverage: 26.434% (-69.7%) from 96.113%
9091a1ae-29be-458c-984a-339d213919c4

Pull #2000

circleci

jrgriffiniii
Removing integration with ActiveStorage
Pull Request #2000: Bump actionpack from 7.2.1.1 to 7.2.2.1

945 of 3575 relevant lines covered (26.43%)

0.35 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
2
class FormResourceDecorator
×
3
  attr_reader :resource, :current_user, :work
×
4

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

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

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

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

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

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

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

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

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

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

52
  private
×
53

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

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